Export using openrowset

  • hi

    INSERT INTO OPENROWSET ('Microsoft.Jet.OLEDB.4.0',

    'Excel 8.0;Database=c:\test\Test.xls;',

    'SELECT id,col1 FROM [Sheet1$]')

    SELECT id,col1 FROM temp_test

    This works fine,

    When I open my excel it is inserted in a1,b1 cells.

    I need to specify the cell names when I need to export rows from sql server to excel.

    Thanks in advance.

  • vsjayashri (7/2/2008)


    hi

    INSERT INTO OPENROWSET ('Microsoft.Jet.OLEDB.4.0',

    'Excel 8.0;Database=c:\test\Test.xls;',

    'SELECT id,col1 FROM [Sheet1$]')

    SELECT id,col1 FROM temp_test

    This works fine,

    When I open my excel it is inserted in a1,b1 cells.

    I need to specify the cell names when I need to export rows from sql server to excel.

    Thanks in advance.

    You will probably need to specify an unamed range:

    replace SELECT * FROM [Sheet1$] for SELECT * FROM [Sheet1$D1:E1]


    * Noel

  • Thanks for the solution

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

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