How to fetch data from excel and insert into sql server tables using sql server 2005 stored procedure

  • Hi,

    I am having a excel document where it conatins more than 10 sheets. All the sheets has data.

    Using sql server 2005 stored procedure, i have to get the excel data and have to insert it in the sql table.

    Paramters passed to the stored procedure will be excel document path.

    Can you guide me to sort this problem ?

    Thanks.

    Kavitha.R

  • As this is the Integration Services forum: I suggest you build a SSIS package to import the data from the excel file into the appropiate tables.

    If needs be, you can start the package from a storedproc.

    If you need a T-SQL-only option, you should post in another forum.

    Peter Rijs
    BI Consultant, The Netherlands

  • This would not be easy, and I'm not sure you can do it in T-SQL. You can use OPENQUERY or OPENROWSET and grab data from Excel, but I'm not sure how you'd read/specify the sheets. SSIS would make this easier.

    Is this something you will do often?

  • I'm with Steve, is this going to happen a bunch or is this a one shot? Also is the spreadsheet ALWAYS going to have the same number of tabs in the same order(or names) with the same fields?

    This is really easy with SSIS if the metadata does not change, if it does then it gets a lot more tricky..

    CEWII

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

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