September 18, 2008 at 5:15 am
I am using a T-SQL script in my job and i want to move to the next step based on the result of my T-SQL script. Is there any option by which i can do this . I do not want to use a package having Eecute SQL task in my job.
September 18, 2008 at 6:33 am
What is that your doing in TSQL Steps? Can you able to return any return global variable from that TSQL?
September 18, 2008 at 7:27 am
Don't think there is a job option to do this. You could try managing it through a process table that each step would update and validate against.
Ex.
Job Step 1
- does some work then updates t_progress
Job Step 2
- checks t_progress
- if appropriate: does some work then updates t_progress
- if not appropriate: skip some work
Job Step 3
- checks t_progress
- if appropriate: does some work then updates t_progress
- if not appropriate: skip some work
etc.
_____________________________________________________________________
- Nate
September 18, 2008 at 7:29 am
yes, iam taking a count and if that count is greater than 0 iam returning
result=1 and if it is not than result =0.
But i am not able to run my job according to the job condition result.
September 19, 2008 at 7:18 am
Insert the count into a table, and then execute the next step based upon what is in the table.
September 19, 2008 at 7:27 am
You could simply use the "success" or "failure" options in the job definition to define branching.
It would look something like:
Step 1: do something for real
Step 2 (branching step)
do your count. The step would look something like this:
Declare @count int
set @count=count(*) from MyTable
where MyCriteria='True'
If @count>0
Raiserror('We are branching down the "failure" line now',16,1)
This will cause this step to fail if the count is >0.
You can then use the advanced settings to decide what to do then.....
----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?
April 16, 2009 at 7:32 am
What if the first step is a T-SQL and second step is a CMD ?
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply