Domanda

I'm trying to import some data from an Excel sheet into an existing SQL Server 2005 table.

The table has the following columns:

Name, Surname, PhoneNumber ,Bill

and they are in the same order in the Excel sheet.

I've never attempted such a thing before, but after searching for a while I was told I could use:

INSERT INTO table 
    SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
                             'Excel 8.0;Database=C:\temp\test.xls',
                             'SELECT * FROM [Sheet1$]')

Do I need to reference the column names from the Excel sheet to the SQL Server table columns?

I'm certainly not a SQL guru, but would consider myself a good beginner.

Can anyone help?

È stato utile?

Soluzione

See here in you Management Studio :
Choose you db? enter image description here

Choose your source :
enter image description here

and from here is all just following the GUI !!

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top