Search code examples
sql-server-2008xlsimport-from-excel

How to selectively import an XLS into an SQL Server 2008 table?


I have an XLS file. Let's assume that it has 1000 rows in all, with 10 columns. I would like to import rows 5 through 995 (say), and columns 1 though 7 and 10. How can I do this using an SQL query, either though OPENROWSET or BULK INSERT? I am using SQL Server 2008.


Solution

  • I had another idea.

    You could also use a Linked Server which connects to the Excel document.
    (This is probably an easier approach for you.)

    See: http://support.microsoft.com/kb/306397