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
 sp_OAMethod

Author  Topic 

avmreddy17
Posting Yak Master

180 Posts

Posted - 2007-10-10 : 09:51:20
Hi Guys,

SET @psFilepath = 'C:\test.txt'
SET @psFilepath = '\\XXXXX\Share\Test\test.txt'
EXECUTE sp_OAMethod @FileSystem , 'OpenTextFile' , @FileHandle OUTPUT , @psFilepath , 2, 1

If I set the file path to '\\XXXXX\Share\Test\test.txt', the above statement does not create the test.txt file. But If I set the Filepath to a local drive it works.

Is it possible to create the files on a Share using sp_OAMethod.

Thanks


shallu1_gupta
Constraint Violating Yak Guru

394 Posts

Posted - 2007-10-17 : 02:05:46
Hi,
you can map this path to a drive and use that to create a text file over there.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-10-17 : 02:18:03
The path is relative to the SQL Server you are executing the statement on.
Also make sure that the user you are connected as has write permissions the the path yuo specifiy.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -