| Author |
Topic  |
|
|
Sonu619
Posting Yak Master
193 Posts |
Posted - 07/27/2012 : 17:24:27
|
Hi guys,
I want to run Job and during job i want to say, If Status is 1 run StoreProcedure1 and if Status is 2 run StoreProcedure2. Please how i can right sql query.
Thanks. |
|
|
tkizer
Almighty SQL Goddess
USA
35007 Posts |
|
|
Sonu619
Posting Yak Master
193 Posts |
Posted - 07/27/2012 : 17:27:04
|
| Database |
 |
|
|
tkizer
Almighty SQL Goddess
USA
35007 Posts |
|
|
Sonu619
Posting Yak Master
193 Posts |
Posted - 07/27/2012 : 17:40:50
|
I have table in SQl, I want to run a job every 5 minutes. in job i want to use this sql script to say or could you please check this sql syntax gonna work
WHILE(1=1) begin If exists (select Distinct id from sales where Status = '1') Begin exec store_Proceudre 1 end else exec store_Procedure2 |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
India
47040 Posts |
Posted - 07/27/2012 : 17:46:05
|
the syntax looks fine. but can you tell whats the purpose of this?
also for exists check you dont need distinct id inside. just select 1 is enough
------------------------------------------------------------------------------------------------------ SQL Server MVP http://visakhm.blogspot.com/
|
 |
|
|
tkizer
Almighty SQL Goddess
USA
35007 Posts |
|
|
Sonu619
Posting Yak Master
193 Posts |
Posted - 07/27/2012 : 17:49:28
|
After i run this syntax keep looping and populating table.. This syntax should run only once and first one because i have only status = 1. Help me out ASAP. Thank You. |
 |
|
|
tkizer
Almighty SQL Goddess
USA
35007 Posts |
|
| |
Topic  |
|