Import of Excel sheets

  • We want to import Excel sheets into our DB. We already designed DTS Packages to do this. But we have to execute the package out of a Stored Procedure. How can we do this.

    Are there any other ways to import Data of an Excel sheet directly in a Stored procedure (perhaps with bulk insert?)

  • Investigate the dtrun command line utility. Type dtsrun /? at the command line for all options. Then call this using xp_cmdshell e.g.

    exec master..xp_cmdshell 'dtsrun /f "C:\Import\CI.dts" /W TRUE'

    Regards,

    Andy Jones

    .

  • Schedule the DTS package to run. Then go to the job that was created and open the one step you will find in there. Copy the line in that step (make sure you get it all). Now paste that line between the single quotes of the following code:

    exec xp_cmdshell ''

    You will get something like this:

    exec xp_cmdshell 'DTSRun /~S 0x01F5C9DCAC4452B25A44BE348C3E19F03900541B561F3515 /~U 0xF8141F8065D98248 /~P 0x4CF2D81A7A1F41C4C5E1CD2BDFBC1DFD /~N 0x0E6F474CFA0562CAE3EA32EF58DFDCC503FFC419D76D7CE3E712038E1AA2ACB1439FFB6CF8F4B4F6F922EF7312D2B202 '

    Now place that code into a stored procedure and execute the stored procedure.

    Robert Marda

    Robert W. Marda
    Billing and OSS Specialist - SQL Programmer
    MCL Systems

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

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