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 |
shapper
Constraint Violating Yak Guru
450 Posts |
Posted - 2007-02-12 : 10:34:59
|
Hello,Inside a stored procedure I have an IF condition.I want to set an output variable to -1, return it and not execute the rest of the code (which would insert a record in a database) if the condition verifies.How can I do this?Thanks,Miguel |
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-02-12 : 10:38:01
|
[code]If <some-condition>Begin Set @outvar = -1 ReturnEndElseBegin -- do whatever you wantEnd[/code]Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-02-12 : 10:38:08
|
if somethingbeginselect yourOutParam = -1returnendGo with the flow & have fun! Else fight the flow blog thingie: http://weblogs.sqlteam.com/mladenp |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-02-12 : 10:38:33
|
awww.... by 7 secondsGo with the flow & have fun! Else fight the flow blog thingie: http://weblogs.sqlteam.com/mladenp |
|
|
|
|
|