Export into Excel file from SQL + Named the output files...

  • Hi,

    Good day. I would need help on the SSIS or SQL.

    I need to create a package/stored procedures to export "selective" data into excel from SQL database. Would you mind to guide me on doing this?

    I found out that can use "Import and Export wizard" in the Visual Studio, but it seems not practical way in my case. If i use "Import and Export wizard" , what's the next?

    Please advise.

  • What are the issues that you are having with the import/export wizard?

  • Hi Steveb,

    It's not able to over-write the existing file when run the package for second time. And, is there a way to rename to file with date-timestamp?

    Please advise.

    Thank you!

  • cold_blue,

    use expression as "your file name_Date_Time.xls" (e.g, "Report_20100707_1230.xls) on ExcelFileath property of the excel connection manager

    and also set DelayValidation property to true.

    RB

  • Hi RB,

    Thanks for your response! Yet, would need your guide on this.

    From the Import & Export wizard, the excel connection will be in Data Flow,right?

    In the excel destination editor, I do not found any tab which is allowed me to create variable. Do you mind to guide in details?

    Thank you!

  • Hi RB,

    I'm able to create variable with the expression you mentioned. Yet, facing error when run the package, do you have any idea on this? Please advise.

    Thanks!

    TITLE: Microsoft Visual Studio

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

    Error at Data Flow Task [Excel Destination [119]]: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005.

    Error at Data Flow Task [Excel Destination [119]]: Opening a rowset for "C:\Documents and Settings\Administrator\Desktop\CustomerID_"+Replace(Replace(Replace(Replace((DT_WSTR,50)(getdate()),"-","")," ","_"),":",""),".","_")+".xls" failed. Check that the object exists in the database.

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

    ADDITIONAL INFORMATION:

    Exception from HRESULT: 0xC02020E8 (Microsoft.SqlServer.DTSPipelineWrap)

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

    BUTTONS:

    OK

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

  • Hi

    As the file becomes dynamic now, you need to create structure to hold data before DFT task,

    Please refer...Rafael articles on the same...

    http://www.rafael-salas.com/2006/12/import-header-line-tables-_116683388696570741.html

    and

    http://www.rafael-salas.com/2008/03/ssis-and-dynamic-excel-destinations_01.html

  • When working with a single data source and a single data destination it is advisable to use the Import and Export wizard with the SQL Server Management Studio (SSMS). That wizard will generate the SSIS package for you (which you can manage like any other SSIS package).

  • Hi all,

    thank you for your advise!

    I'm able to solve it out by using Import & Export wizard ,and with the variable to set the DateTime as part of the filename.

    Thank you! 😉

Viewing 9 posts - 1 through 8 (of 8 total)

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