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
 General SQL Server Forums
 New to SQL Server Programming
 Pulling Data using OPENROWSET

Author  Topic 

funk.phenomena
Posting Yak Master

121 Posts

Posted - 2012-07-19 : 13:12:21
Hi All - I'm currently using SSMS 2008 and logged into another server; using the OPENROWSET command to pull data.

It works fine when the file saved to the server's local hard drive:


SELECT * FROM OPENROWSET ('MSDASQL','Driver={Microsoft Text Driver (*.txt; *.csv)};', 'SELECT * from G:\temp\AUDIT.CSV')


However, when I try and have it pull the exact same file from a shared folder on my workstation, it can't pull it.


SELECT * FROM OPENROWSET ('MSDASQL','Driver={Microsoft Text Driver (*.txt; *.csv)};', 'SELECT * from \\DESKTOP1549\AUDIT.CSV')


I'm assuming this has to do with server permissions, and might be more of a complex issue. I figure I'll try here, and see if any bright minds can help me, Thanks!

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-07-19 : 13:15:52
does the account under which you run statement has access to path ? if yes try

select * from OpenRowset('MSDASQL', 'Driver={Microsoft Text Driver (*.txt; *.csv)};
DefaultDir=\\DESKTOP1549;','select * from AUDIT.CSV')



------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -