Importing from excel | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Importing from excel

I am trying to import from excel using a Distributed query.
I just want to know if its possible to specify what columns to import if I dont want everything.
I’ve tried putting in the column names but this wont work. INSERT INTO Shortages SELECT * FROM OPENDATASOURCE(‘Microsoft.Jet.OLEDB.4.0′,’Data Source=C: estxltest.xls;Extended Properties=Excel 8.0’)…[Shortages$]" The above works but how can i specify only to insert column1, column2 ?
Try with OPENQUERY and refer to Books online for more information. Satya SKJ
Moderator
http://www.SQL-Server-Performance.Com/forum
This posting is provided “AS IS” with no rights for the sake of knowledge sharing.
Does OPENQUERY require a Linked server?
Yes, Executes the specified pass-through query on the given linked server, which is an OLE DB data source. The OPENQUERY function can be referenced in the FROM clause of a query as though it is a table name. The OPENQUERY function can also be referenced as the target table of an INSERT, UPDATE, or DELETE statement, subject to the capabilities of the OLE DB provider. Satya SKJ
Moderator
http://www.SQL-Server-Performance.Com/forum
This posting is provided “AS IS” with no rights for the sake of knowledge sharing.
]]>