octavian10
MIS
I recently got some great help with the xp_fileexist sp, in a test lab I tried to use this sp to see if a file exists on a network share not on a local disk and it would not work. This is the code, which I recevied from gmmastros (thanks again) that works great on the local machine.
Declare @FileExists Int
exec master..xp_fileexist 'C:\document.txt', @FileExists Out
If @FileExists = 1
Select 'File Does Exist'
Else
Select 'File Not Found'
When this is modified to look for a file on another server like this,
Declare @FileExists Int
exec master..xp_fileexist '\\server-1\C$\document.txt', @FileExists Out
If @FileExists = 1
Select 'File Does Exist'
Else
Select 'File Not Found'
I always get File Not Found even though the file is there.
On the same pc that this sp is being run from I can type \\server-1\C$\document.txt into either command prompt or run and I can get to this file. Any help would be great. I can easily get around this using .net code to check for this file and copy it to the sql machine but I would like to know what I am doing wrong as far as this sp is concerned.
Thanks for your time.
"I hear and I forget. I see and I remember. I do and I understand."
- Confucius (551 BC - 479)
Declare @FileExists Int
exec master..xp_fileexist 'C:\document.txt', @FileExists Out
If @FileExists = 1
Select 'File Does Exist'
Else
Select 'File Not Found'
When this is modified to look for a file on another server like this,
Declare @FileExists Int
exec master..xp_fileexist '\\server-1\C$\document.txt', @FileExists Out
If @FileExists = 1
Select 'File Does Exist'
Else
Select 'File Not Found'
I always get File Not Found even though the file is there.
On the same pc that this sp is being run from I can type \\server-1\C$\document.txt into either command prompt or run and I can get to this file. Any help would be great. I can easily get around this using .net code to check for this file and copy it to the sql machine but I would like to know what I am doing wrong as far as this sp is concerned.
Thanks for your time.
"I hear and I forget. I see and I remember. I do and I understand."
- Confucius (551 BC - 479)