October 26, 2005 at 10:05 am
I have a job with 10 steps involved in it. The sec step of my job looks for a file and if that doesnt exists it shouldnt go any further with other steps but stop there itself. Whats the best way to implememnt this? I get an error when i have the following on my step2.
declare @deletecmd varchar(100),
@filename varchar(200),
@fstatus int
select @filename = '\\nts_fps100\ftproot$\abc.txt'
exec master..xp_fileexist @filename, @fstatus out
if @fstatus = 1 -- File Exists
begin
exec xp_cmdshell 'DTSrun -S<servername>-E -N "XXX"', no_output
end
else
return
any help will be greatly appreciated.
TIA
October 26, 2005 at 10:08 am
How about check for the file first, then start the job?
October 26, 2005 at 10:11 am
Can you please let me know how to do that. Check for the file existance where ??thanks
October 26, 2005 at 10:15 am
I think I would make a new job. This job first step would to check for the file. If it's there, then start the current job (sp_startjob).
October 26, 2005 at 10:29 am
Thank you so much. That worked very well.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply