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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 CASE in T-SQL

Author  Topic 

verinow_mark
Starting Member

2 Posts

Posted - 2006-05-04 : 17:11:12
In some languages you can do something like:
x = 2
DO CASE
CASE x =1
do something
CASE x =2
do something -- this would run
CASE x =3
do something
ENDCASE

What is similiar in T-SQL?
Thanks.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-05-04 : 17:14:32
T-SQL has a CASE statement. Check out CASE in SQL Server Books Online for more details.

Tara Kizer
aka tduggan
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2006-05-04 : 17:15:08
IF...ELSE...ELSE IF. SQL has a CASE expression, but it does not control program flow. Only IF can do that.
Go to Top of Page
   

- Advertisement -