Wednesday, March 7, 2012

Multiple conditions in "IF" statement in T-SQL?

Hi All,

Just wondering if anyone can tell me if you can test for multiple
conditions as part of an "IF" statement in T-SQL in SQL Server 2000?

ie something like:

IF @.merr = 1 or @.merr=2
Begin
SELECT statement
UPDATE statement
End

Any help much appreciated!

Much warmth,

M.M Wells (planetquirky@.planetthoughtful.org) writes:
> Just wondering if anyone can tell me if you can test for multiple
> conditions as part of an "IF" statement in T-SQL in SQL Server 2000?
> ie something like:
> IF @.merr = 1 or @.merr=2
> Begin
> SELECT statement
> UPDATE statement
> End

Yes you can.
--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp

No comments:

Post a Comment