Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Other SQL Server Topics (2005)
 OLE DB provider "Microsoft.Jet.OleDB.4.0" Error

Author  Topic 

collie
Constraint Violating Yak Guru

400 Posts

Posted - 2009-09-09 : 10:15:36
Hi,

Can someone please help me?

When i run the query below i get the error in red. However, if i change the sheetname to only catalog than it seems to be working fine. The problem is that i can't ask the user to change the sheetname and also i would like to know how to solve this error .



The OLE DB provider "Microsoft.Jet.OleDB.4.0" for linked server "(null)" does not contain the table "catalog SU08$". The table either does not exist or the current user does not have permissions on that table.

  declare  @SheetName varchar(20)

declare @FilePath varchar(100)

declare @HDR varchar(3)

set @FilePath='c:\test\Catalog_big.xls'
set @SheetName='catalog SU08$'
set @HDR=1
DECLARE @SQL nvarchar(1000)
SET @SQL = ' SELECT * INTO #tmptest FROM OPENDATASOURCE'

SET @SQL = @SQL + '(''Microsoft.Jet.OLEDB.4.0'',''Data Source='

SET @SQL = @SQL + @FilePath + ';Extended Properties=''''Excel 8.0;HDR='

SET @SQL = @SQL + @HDR + ''''''')...['

SET @SQL = @SQL + @SheetName + ']'

EXEC sp_executesql @SQL


Whisky-my beloved dog who died suddenly on the 29/06/06-I miss u so much.

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-09-10 : 02:50:23
Have you tried using Openrowset?
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=49926

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -