May 4, 2010 at 11:06 am
Hello Everyone
I am trying to remember the function name in the SQL Books Online that can be used in a select statement, that if the value in the table is a certain value, return a value, but if not, return something else
Now that everyone is totally confused 😀
It is very difficult to look up the function name, when you don't know the function name. Some are pretty easy, like LEN, but for the life of me, I cannot think of the name for this one
pseudo code:
IF TypeID > 1
THEN
TypeID = 1
ELSE
TypeID = 0
This is as close as I can come in my explanation. TypeID is the column name.
Thanks
Andrew SQLDBA
May 4, 2010 at 11:10 am
CASE
ie.
SELECT CASE WHEN Yourvalue IN ('Yes','No','Maybe') THEN YourValue ELSE 'Invalid' END as Result
From YourTable
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply