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 |
|
jim65
Starting Member
35 Posts |
Posted - 2006-02-10 : 16:09:55
|
| I know I can use if(@a=1) do something can I use (if else) like this way.if(@a=1 and @b=2) doing something. because I have two conditionsmany thanks |
|
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2006-02-10 : 16:39:15
|
Yesread books onlinequote: ANDCombines two Boolean expressions and returns TRUE when both expressions are TRUE. When more than one logical operator is used in a statement, AND operators are evaluated first. You can change the order of evaluation by using parentheses.Syntaxboolean_expression AND boolean_expression
|
 |
|
|
jim65
Starting Member
35 Posts |
Posted - 2006-02-10 : 16:52:52
|
| Thanks, I mean that this should be used in T-SQL. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2006-02-10 : 16:55:43
|
| The answer is still yes. Check out SQL Server Books Online for details. It is the help documentation for SQL Server.Tara Kizeraka tduggan |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2006-02-11 : 14:29:46
|
| If you gave some better examples it might help, and the strong suggestion about BOL are good, but here are some examplesIF @a = 1 SELECT * FROM sysobjectsIF @a = 1 AND @b = 2 SELECT * FROM sysobjectsIF @a = 1 SELECT * FROM sysobjectsELSESELECT * FROM sysobjectsIF @a = 1 AND @b = 2BEGINSELECT * FROM sysobjects-- Some other stuffENDELSEIF @a = 1 AND @b = 1BEGIN--StuffENDBrett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxAdd yourself!http://www.frappr.com/sqlteam |
 |
|
|
jim65
Starting Member
35 Posts |
Posted - 2006-02-11 : 15:27:06
|
| Thanks a lot. it's huge help. |
 |
|
|
|
|
|