November 27, 2008 at 11:33 pm
Hi
I have scheduled a sql server job where in I am importing a data file. I want the job to be executed based on a condition. i.e I will execute a script in the sql command portion of sql sever job and if the script then I want to execute the job else a message should be given.
How this can be done
Thanks in advance.
Simha
November 28, 2008 at 3:36 am
What is the condition? If it is a variable stored in a table in a database you can include it in the sql script - if it is something more complicated like whether it is raining outside it might be slightly harder 🙂
ed
November 28, 2008 at 3:44 am
hi
Thanks for the reply. The condition is based on data from a table. The script i have written in the sql command of sql job is simply like this
declare @i bit
select @i= col1 from table where col2=123
if @i=1
execute the job
else
stop the job
Is there any other better way of doing this????
November 28, 2008 at 3:49 am
why don't you just have that at the top of your sql command - if it does match then just have a return then the rest of the script won't run.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply