all groups > sql server programming > february 2005 >
You're in the

sql server programming

group:

Syntax for switch case


Syntax for switch case Sansanee
2/3/2005 7:07:10 PM
sql server programming:
Hi,

I am wondering if there is any sql syntax that do the switch case like
If there is 'X'
return X
Else if there is Y
return Y
else return null

Thank you in advance,

Sunny

Re: Syntax for switch case Louis Davidson
2/3/2005 9:11:52 PM
If you are talking about control of flow language, no, there is nothing like
this other than IF ELSE. There is a CASE expression, but it used to return
a scalar, kind of like IIF does in VB.

--
----------------------------------------------------------------------------
Louis Davidson - drsql@hotmail.com
SQL Server MVP

Compass Technology Management - www.compass.net
Pro SQL Server 2000 Database Design -
http://www.apress.com/book/bookDisplay.html?bID=266
Note: Please reply to the newsgroups only unless you are interested in
consulting services. All other replies may be ignored :)

[quoted text, click to view]

AddThis Social Bookmark Button