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 2000 Forums
 Transact-SQL (2000)
 SQL OLE 'FileSystemObject' Permissions

Author  Topic 

venkat09
Starting Member

17 Posts

Posted - 2010-03-02 : 04:20:09
Hi,

In my SQL query, I use Scripting.FileSystemObject to read a file at a location on a different machine.

Consider this piece of code:

declare @FSO int
declare @FilePointer int
declare @FilePath nvarchar(256)

set @FilePath = '\\AnotherServer\BAVProj\SomeFile.dat'

execute @HR = sp_OACreate 'Scripting.FileSystemObject', @FSO OUT
execute @HR = sp_OAMethod @FSO, 'OpenTextFile', @FilePointer OUT, @FilePath, 2, TRUE, 0

print @HR
...
...
...

I get a HResult: -2147023570 whose unsigned Hex is 0x8007052E,
which means "Logon Failure: Unknown username or bad password".
(Ofcourse the path on the server is shared and has been given full access permission to everyone)

I don't get any error when I try to access files on the same machine.

How can I give credentials there? Actually there should not be any credentials required.

Any help is appreciated.

Thanks,
Renuka Prasad.

Venkat R. Prasad
   

- Advertisement -