Copying XLS (local) directly to SQL (remote) Table without Link srver and BCP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • iitt2007
    New Member
    • Feb 2008
    • 13

    Copying XLS (local) directly to SQL (remote) Table without Link srver and BCP

    I have a XLS file on local machine and would like to copy all the columns to a new SQL table on the 'remote' (not local sql server) using SQL scripts.

    I tried following :
    select * into TEMP_PLAN_CODE FROM OPENROWSET('Mic rosoft.Jet.OLED B.4.0',
    'Excel 10.0;Database=D :\Placodes.xls; HDR=YES',
    'SELECT * FROM [Sheet1$]')

    but it's giving me an error :
    Msg 7415, Level 16, State 1, Line 1
    Ad hoc access to OLE DB provider 'Microsoft.Jet. OLEDB.4.0' has been denied. You must access this provider through a linked server.

    I can't create linked server as well and can't run BCP (no authority)

    What are my available choices for copying XLS (on local) to SQL (not local) tales using SQL scripts and not using any .NET code.

    Thanks in advance
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    Originally posted by iitt2007
    I have a XLS file on local machine and would like to copy all the columns to a new SQL table on the 'remote' (not local sql server) using SQL scripts.

    I tried following :
    select * into TEMP_PLAN_CODE FROM OPENROWSET('Mic rosoft.Jet.OLED B.4.0',
    'Excel 10.0;Database=D :\Placodes.xls; HDR=YES',
    'SELECT * FROM [Sheet1$]')

    but it's giving me an error :
    Msg 7415, Level 16, State 1, Line 1
    Ad hoc access to OLE DB provider 'Microsoft.Jet. OLEDB.4.0' has been denied. You must access this provider through a linked server.

    I can't create linked server as well and can't run BCP (no authority)

    What are my available choices for copying XLS (on local) to SQL (not local) tales using SQL scripts and not using any .NET code.

    Thanks in advance
    You can create a client-side apps that will read the excel file and connect to your SQL-Server and INSERT your excel columns into that table. I have tried with EXCEL before but that was a much earlier version. Since Microsoft products have built-in OLE's in them, you can use Excel's VBA to connect to your sql server and populate your table.

    Actually whatever tool (maybe C#) that can read excel files and can connect and run t-sql to a sql-server can do this task.

    -- CK

    Comment

    Working...