Generate Excel Files in MsSQL 2008R2

  • Hi All,

    I am trying to automate Excel file generation through either SSIS or T-SQL code directly.

    Unfortunately my data source for Excel always have different number of fields and fieldnames.

    It is simply a stored procedure execution result.

    In SSIS `Excel file destination` requires set number of fields and types.

    So I had looked and using JET and Openrowset, see below:

    insert into openrowset

    (

    'Microsoft.Jet.OLEDB.4.0',

    'Excel 8.0;Database=C:\\template.xls',

    'select * from [Sheet1$]'

    )

    select 'blabla', 'USA', 4;

    this fails with: OLE DB provider 'Microsoft.Jet.OLEDB.4.0' cannot be used for distributed queries because the provider is configured to run in single-threaded apartment mode.

    I have to mention that MsSQL R2 installation is a cluster one and JET simply does not exists in 64 bit flavor.

    I am looking for a working solution.

    OpenXML document format and CLR code is the option that I have in mind.

    But, Do I really have to go that route ???

    Thanks.

  • Maybe you can use the ACE OLE DB provider, this one is available in 64-bit.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

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

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