looping through table values, exporting to excel

  • Hi Justin

    How are you going...

    The package i sent you should work ones you specify the database connection and the variable path...

    Let me know if you need help

    Cheers

  • Hi Jeff

    No worries... Am learning it myself...

    Hope you enjoy learning it

    Cheers

  • i took the package you sent and all i did was adjust the connection managers since i don't have the same paths as you did. i am getting this error.

    Error: 0xC002F210 at Execute SQL Task, Execute SQL Task: Executing the query "CREATE TABLE `Excel Destinationlo` (

    `Copy of pid` INTEGER,

    `Copy of pname` NVARCHAR(50)

    )" failed with the following error: "Table 'Excel Destinationlo' already exists.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

    Task failed: Execute SQL Task

    Warning: 0x80019002 at Foreach L

    This error leads me to believe that i need to delete the excel sheet so that it will be created when the package runs. however when i try to run the package with no Excel Destinationlo on the .xls then i get this error.

    TITLE: Package Validation Error

    ------------------------------

    Package Validation Error

    ------------------------------

    ADDITIONAL INFORMATION:

    Error at Data Flow Task [Excel Destination [738]]: An OLE DB error has occurred. Error code: 0x80040E37.

    Error at Data Flow Task [Excel Destination [738]]: Opening a rowset for "Excel Destinationlo" failed. Check that the object exists in the database.

    Error at Data Flow Task [DTS.Pipeline]: "component "Excel Destination" (738)" failed validation and returned validation status "VS_ISBROKEN".

    any ideas here?

  • Hi Justin

    Lets start over with the excel - Create one spreadsheet and leave the name as default

    Open the connection manager in ssis - remove the setting in the expression task

    and disable the execute sql task in the for each loop editor and try running hte package as is... it should not work but will give you an idea that things are ok... It will not work because there is a create table statement which cant create the same table over and over again in the same sheet.

    Open the spreadsheet again remove the sheet created and leave the one sheet with default name

    Enable the Execute sql task in the For each loop editor

    add the expression back in the Excel connection manager

    Save and try again...

    Just so you know it took me two weeks appx to work this out because of all errors... I had help from a member called Anu in the forums... So please dont give up and its almost there...

    please send me a copy of the package and i will help as well

    Cheers

    Vani

  • Hi Justin

    how are you going with this

    Let us know if you need help

    Cheers 🙂

  • this is going to have to take a back seat for a few days while i work on quarterly reporting. i appreciate your assistance thus far and plan on digging back in after i complete my task.

    -js

  • okay! small victory thanks to all on this thread (esp Vani). i was able to get the tutorial to work and have been playing around with it, trying to tailor it to my requirements.

    one thing i have run across so far, and i'm not sure if there's a fix, and that is i need to be able to show leading or trailing zeroes in my excel file. if i insert values into the table with trailing/leading zeroes and run the package, the trailing/leading zeroes are removed in excel, i guess since the containing cell is formatted to General by default? is there a solution that anyone knows of here?

Viewing 7 posts - 16 through 21 (of 21 total)

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