Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Sonu619
Posting Yak Master
202 Posts |
Posted - 2012-07-27 : 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
38200 Posts |
|
Sonu619
Posting Yak Master
202 Posts |
Posted - 2012-07-27 : 17:27:04
|
Database |
 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
Sonu619
Posting Yak Master
202 Posts |
Posted - 2012-07-27 : 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 sayor could you please check this sql syntax gonna workWHILE(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
52326 Posts |
Posted - 2012-07-27 : 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 MVPhttp://visakhm.blogspot.com/ |
 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
Sonu619
Posting Yak Master
202 Posts |
Posted - 2012-07-27 : 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
38200 Posts |
|
|
|
|