May 17, 2011 at 9:56 am
Not sure if I have this in the right forum.
I have a job setup to run a package but I want one of the job steps to look if the file exists before even running the package so I don't waste time running it if not needed.
The other issue is the whole file name isn't always the same so I can't look for an absolute path \\server\myfile.csv its more like \\server\myfile_date_time.csv, so I just want to look if there is a file myfile*.csv
I tried xp_fileexist but it seems to be for specific name and not partial name like:
Exec Master.dbo.xp_fileexist '\\server\myfile.csv'
works fine but like I said my is more like \\server\myfile*.csv and I don't know how to adjust.
Thanks.
May 17, 2011 at 11:58 am
I think you will have to allow the package to start, HOWEVER, you can add a script right at the beginning to determine whether to go on with the process. Add a variable that is set to 1 or 0 and add an expression the the arrow between the new step and the rest of the process that depends on that variable being set to 1. Basically if the process doesn't set it to 1 then the file was not found and we are done, if it does we continue.
That script task should give you the flexibility you need.
CEWII
May 17, 2011 at 12:28 pm
Ok, I have it set up now similar to that.
Thanks!
May 17, 2011 at 12:46 pm
You are very welcome.
CEWII
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply