Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jul 17, 2010 09:34 AM by nizam133
Member
327 Points
453 Posts
Jul 16, 2010 07:38 PM|LINK
I always get confused with the syntax of CASE in T-SQL. Basically there are two ways to use CASE. So I decided to post it for reference
Suppose "TermID" is the field in the Database Table
1)The first syntax is more like other languages where we pass some value in SWITCH and then chenk in CASE
FROM Invoices
Hope this helps someone
Contributor
3538 Points
638 Posts
Jul 17, 2010 09:34 AM|LINK
hey if you want to do only equality check then first one you will use (you can also use second one)
you can use anyone of them
helpjet
Member
327 Points
453 Posts
Tow Ways to Use SQL -|- CASE-WHEN-THEN-ELSE-END
Jul 16, 2010 07:38 PM|LINK
I always get confused with the syntax of CASE in T-SQL. Basically there are two ways to use CASE. So I decided to post it for reference
Suppose "TermID" is the field in the Database Table
1)The first syntax is more like other languages where we pass some value in SWITCH and then chenk in CASE
Hope this helps someone
Replies.AsEnumerable()
.Where(rep =>rep.YouLookingFor.Equals('helpjet'))
.Select (new {Mark As Answer = 'helpjet'})
nizam133
Contributor
3538 Points
638 Posts
Re: Tow Ways to Use SQL -|- CASE-WHEN-THEN-ELSE-END
Jul 17, 2010 09:34 AM|LINK
hey if you want to do only equality check then first one you will use (you can also use second one)
you can use anyone of them