Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

Check if file exists SP with partial filename match???

$
0
0

Hello all,

I have a job subtask which I have a question about. The subtask checks if files exist in a directory and I want for it to be able to work against partial file names. If you look at my code example you will see a psuedocode of what i want to accomplish and what is the current code, thanks spicesters.
SQL
--What I am trying to make happen: DECLARE@FILE_EXISTSINTDECLARE@FILENAMEvarchar(255)@FILENAME=LIKEN'\\server\FTP\XXX\helloworld%'EXECmaster.dbo.xp_FileExist@FILENAME,@FILE_EXISTSOUTPUTIF(SELECT@FILE_EXISTS)<1RAISERROR('File not found.',16,1)GO--Original execution code:DECLARE@FILE_EXISTSINTEXECmaster.dbo.xp_FileExistN'\\server\FTP\XXX\helloworld09022016.txt',@FILE_EXISTSOUTPUTIF(SELECT@FILE_EXISTS)<1RAISERROR('File not found.',16,1)



Viewing all articles
Browse latest Browse all 4871

Trending Articles