Using Condition t-SQL (IF…ELSE by CASE…END)

If we want to use If..Else, WHEN or similar types of condition in our SQL query, its need to be done by using CASE…..END. More details can be found in:

http://msdn.microsoft.com/en-us/library/ms181765.aspx

Please look at the examples at the end of msdn link.

For me, I had to use it lots of places when I have started working in student ILR data XML data return. A part of the huge query using CASE:

 

Advertisements
By simplemsexchange Posted in SQL 2008

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s