write result in excel file.

  • Leah

     

    I ran your query against the pubs database. The only change was the last argument for the path for the xls file.

     

    DECLARE @SQL varchar(8000)

     BEGIN

      SET @SQL =

      'select au_lname,   au_fname,  phone,  address,   city, state, zip  from dbo.authors '

    --   select @SQL

    --   exec (@SQL)

      exec HPSP_UT_ExcelReport 'Test_XLS', @SQL, 'Test_XLS', 'Last_Name text, First_Name text, Phone text, Address text, City text, State text, Zip text'

       ,'\\server02\c$\temp\'

     

     END

     

    I received the following error. The xls file was created but only contained the column headings.

     

    (1 row(s) affected)

     

     

    (1 row(s) affected)

     

    Created OLE ADODB.Connection object

                Assigned ConnectionString property

                Open Connection to XLS, for file Create or Append

    Server: Msg 7314, Level 16, State 1, Line 1

    OLE DB provider 'EXCEL_TEST' does not contain table 'Test_XLS'.  The table either does not exist or the current user does not have permissions on that table.

    Destroyed OLE ADODB.Connection object

    OLE DB error trace [Non-interface error:  OLE DB provider does not contain the table: ProviderName='EXCEL_TEST', TableName='Test_XLS'].

     

    Howard

  • 1. check your rights.

    2.make sure that the spreadsheet name is unique, and noone has it open.

    3.Try to delete the file you already created and run the sp again

    4. If you are running it from the QA, put the path as 'C:\Temp\". Just for testing purposes.

    I ran the script many times, and I am sure that it's correct.

     

    Leah Kats

  • Leah:

     

    1. check your rights.

    Rights are okay.

    2.make sure that the spreadsheet name is unique, and no one has it open.

    It is unique and no one else has it open.

    3.Try to delete the file you already created and run the sp again

    I did.

    4. If you are running it from the QA, put the path as 'C:\Temp\". Just for testing purposes.

    I did

    I ran your scipt:

     

    DECLARE @SQL varchar(8000)

     BEGIN

      SET @SQL =

      'select au_lname,   au_fname,  phone,  address,   city, state, zip  from dbo.authors '

    --   select @SQL

    --   exec (@SQL)

      exec HPSP_UT_ExcelReport 'Test_XLS', @SQL, 'Test_XLS', 'Last_Name text, First_Name text, Phone text, Address text, City text, State text, Zip text'

       ,'C:\Temp\'

     

     END

     

    The results are:

     

    (1 row(s) affected)

     

     

    (1 row(s) affected)

     

     

    (1 row(s) affected)

     

     

    (1 row(s) affected)

     

     

    (1 row(s) affected)

     

    Created OLE ADODB.Connection object

                Assigned ConnectionString property

                Open Connection to XLS, for file Create or Append

    Server: Msg 7314, Level 16, State 1, Line 1

    OLE DB provider 'EXCEL_TEST' does not contain table 'Test_XLS'.  The table either does not exist or the current user does not have permissions on that table.

    Destroyed OLE ADODB.Connection object

    OLE DB error trace [Non-interface error:  OLE DB provider does not contain the table: ProviderName='EXCEL_TEST', TableName='Test_XLS'].

     

    Howard

Viewing 3 posts - 16 through 17 (of 17 total)

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