Hello
I am writing my own Job within SQL server agent and would like to execute a certain step based on a previous statement.
So far I have
Basically if the status is 'Successfull I want to call an step 2 which will proceed with the rest of my job but if its fail I want it to call step 4 which will email me and notify me of an error.
Can anyone fill in the blanks for me between the Begin and End.
I'm think its something like:
Exec step1.
Can someone help?
Oh yes i'm on SQL server 2000 version 8
I am writing my own Job within SQL server agent and would like to execute a certain step based on a previous statement.
So far I have
Code:
DECLARE @FLAG varchar(50)
SET @FLAG = (select status from test)
if @flag = 'Successful'
begin
'Want to call a step2 here'
end
if @flag = 'Fail'
begin
'Want to call Step3 here'
end
Basically if the status is 'Successfull I want to call an step 2 which will proceed with the rest of my job but if its fail I want it to call step 4 which will email me and notify me of an error.
Can anyone fill in the blanks for me between the Begin and End.
I'm think its something like:
Exec step1.
Can someone help?
Oh yes i'm on SQL server 2000 version 8