Linked Server Concepts in Sql Server 2005

  • Hi All..

    I am using the below statements to create a linked server with the Excel file and also to view the contents of that...

    I would like to insert new data into that excel file from Sql server 2005 using liked server concept.

    Is it possible to insert data in that way..?

    Can any describe that or offer any other better solution??

    Example:

    --Use Test

    --

    --EXEC sp_addlinkedserver 'ImportData',

    --

    --'Jet 4.0', 'Microsoft.Jet.OLEDB.4.0',

    --

    --'C:\ExcelData1.xls',

    --

    --NULL,

    --

    --'Excel 8.0'

    SELECT *

    FROM OPENQUERY(ImportData, 'SELECT * FROM [EmployeeDataTesting$]')

    Ramkumar . K
    Senior Developer
    ######################
    No Surrender... No Give Up....
    ######################

  • Try the following syntax:

    Use Test

    go

    EXEC sp_addlinkedserver 'ImportData',

    'Jet 4.0', 'Microsoft.Jet.OLEDB.4.0',

    'C:\ExcelData1.xls',

    NULL,

    'Excel 8.0'

    SELECT *

    FROM ImportData...[EmployeeDataTesting$]

    -- insert

    INSERT INTO ImportData...[EmployeeDataTesting$] (Field1, Field2)

    VALUES ('value1','value2')

  • Thanks tung..

    Thats working fine..

    Ramkumar . K
    Senior Developer
    ######################
    No Surrender... No Give Up....
    ######################

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

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