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 |
|
khufiamalik
Posting Yak Master
120 Posts |
Posted - 2008-10-15 : 05:01:47
|
| Hello all,I have a condition in my SP and I want to stop further processing when this condition is meet during the SP execution.Can any one explain that how can i Stop further processing????Can I use Return or break like statements?Thanks in advance |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-15 : 05:07:15
|
| You've break in t-sql also. but can i ask from where you want to stop execution? and also under what condition? |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-10-15 : 05:07:42
|
| Use ReturnMadhivananFailing to plan is Planning to fail |
 |
|
|
khufiamalik
Posting Yak Master
120 Posts |
Posted - 2008-10-15 : 05:12:00
|
| When I used Return it gave me the given below error"A severe error occurred on the current command. The results, if any, should be discarded"and my Syntax was like if @lMarginal_Slab_ID=0 begin Set @opMessage_Code='MSG_E11'; Set @opTotal_Annual_Tax=0; return end |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-10-15 : 08:51:00
|
quote: Originally posted by khufiamalik When I used Return it gave me the given below error"A severe error occurred on the current command. The results, if any, should be discarded"and my Syntax was like if @lMarginal_Slab_ID=0 begin Set @opMessage_Code='MSG_E11'; Set @opTotal_Annual_Tax=0; return end
Is this part of a procedure?MadhivananFailing to plan is Planning to fail |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-15 : 09:45:56
|
| Still cant understand when you want to break from execution and why |
 |
|
|
rohitkumar
Constraint Violating Yak Guru
472 Posts |
Posted - 2008-10-15 : 11:05:43
|
quote: Originally posted by khufiamalik Hello all,I have a condition in my SP and I want to stop further processing when this condition is meet during the SP execution.Can any one explain that how can i Stop further processing????
isn't that a simple IF ELSE condition? |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-15 : 11:08:56
|
quote: Originally posted by rohitkumar
quote: Originally posted by khufiamalik Hello all,I have a condition in my SP and I want to stop further processing when this condition is meet during the SP execution.Can any one explain that how can i Stop further processing????
isn't that a simple IF ELSE condition?
that can also be a solution...unless OP explains his actual scenario we're not sure what he's after |
 |
|
|
|
|
|