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
 Transact-SQL (2005)
 OPENROWSET in SQL Server 2008

Author  Topic 

Kalaiselvan
Posting Yak Master

112 Posts

Posted - 2010-11-16 : 23:33:43
Hi,
We are using Upload concepts in our Projects. Fetching records from CSV file and we will upload into our Database. Its working fine in SQL Server 2005 (OpenrowSet concept)..

Now we have upgraded our server to SqlServer 2008. Here the Upload concept is not working because of OPENROWSET problem in Sql Server 2008 server.

SELECT * INTO ##TEMP
FROM OPENROWSET(''MSDASQL'',''Driver={Microsoft Text Driver (*.txt; *.csv)}; DefaultDir='+@FilePath+''', ''select * from '+@FileName+''') A WHERE A.EMpNo<>'''' AND A.EMpNo IS NOT NULL'

This is the Query we are using in Upload from Excel file.

"Cannot initialize the data source object of OLE DB provider "MSDASQL" for linked server "(null)"."

This is the error which comes while upload..

We are using Windows Server 2008 OS in our server with Sql Server 2008 Maanagement Studio.
Please help me in this.....

Regards,
Kalaiselvan R
Love Yourself First....

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-11-17 : 05:00:23
The entire statement should be in dynamic sql
Refer this post (somwehere you can find)
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=49926

Madhivanan

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

Sachin.Nand

2937 Posts

Posted - 2010-11-17 : 05:06:53
quote:
Originally posted by madhivanan

The entire statement should be in dynamic sql
Refer this post (somwehere you can find)
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=49926

Madhivanan

Failing to plan is Planning to fail



But the OP mentioned that it works fine with SQL 2005.

PBUH

Go to Top of Page
   

- Advertisement -