Use Excel Spreadsheet in Cursor

  • Does anyone know how to use an Excel Spreadsheet as the from clause in a cursor? I'm trying to use data in an excel spreadsheet and perform function on the data row by row. The data will be be used to do updates and inserts in the database. I have to do this without using a linkserver as well.

  • The first question has got to be, why do you need a cursor?

    but apart from that...

    why do you not just load the data from the spreadsheet into a temp or staging table in the server and access it from there?  (DTS can be used to load the data)  I haven't tried using an odbc driver using a DSN and setting up a linked server to that... is that not possible?

  • SELECT * FROM

    OPENROWSET('Microsoft.Jet.OLEDB.4.0',

    'Excel 8.0;Database=C:\temp\book1.xls', [sheet1$])

    Far away is close at hand in the images of elsewhere.
    Anon.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply