send data into excel sheet

  • hi ,

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

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

    'SELECT * FROM [Sheet1$]') select * from Person.Contact

    plz tell me how can i use this query because when i try to run this query this error comes.

    ''Msg 15281, Level 16, State 1, Line 1

    SQL Server blocked access to STATEMENT 'OpenRowset/OpenDatasource' of component ''

  • By default OPENROWSET is disabled. You have to go to Surface Area Configuration tool and enable it.

    Piotr

    ...and your only reply is slàinte mhath

  • The above is correct, but if you'd like to do it from SSMS:

    IF

    (

    SELECT value FROM sys.configurations

    WHERE name = 'show advanced options'

    ) = 0

    BEGIN

    EXEC sp_configure 'show advanced options', 1

    RECONFIGURE

    END

    IF

    (

    SELECT value FROM sys.configurations

    WHERE name = 'Ad Hoc Distributed Queries'

    ) = 0

    BEGIN

    EXEC sp_configure 'Ad Hoc Distributed Queries', 1

    RECONFIGURE

    END

  • hi,

    thaxx for reply but i have already done it with surface area configuration . still i have a error

    OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)" returned message "The Microsoft Jet database engine could not find the object 'Sheet1$'. Make sure the object exists and that you spell its name and the path name correctly.".

    Msg 7350, Level 16, State 2, Line 1

    Cannot get the column information from OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)".

    plz tell me what can i do now ???

    thaxx

    jagpal singh

  • The Microsoft Jet database engine could not find the object 'Sheet1$'. Make sure the object exists and that you spell its name and the path name correctly

    The error speaks for itself ...

Viewing 5 posts - 1 through 4 (of 4 total)

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