I have a SP reading a .txt file from File System and using Bulk Insert. I just wanna make sure if file exists before executing bulk insert command. How do i do that?
try
xp_fileExist ' <file Name> '
The above returns a result set. If you want just a variable, use
declare @FileOK INT
exec xp_fileExist 'c:\autoexec.bat' ,@FileOK OUTPUT
Print @FileOK
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With