Is there any better way to write the lines below in SQL Server 2005?
WHEN (ID IS NULL)
WHEN (ID IS NOT NULL)
END AS ID_Value,
IF(ID IS NULL, 'YES', 'NO') AS ID_Value
Did you try:
CASE WHEN (ID IS NULL) THEN 'YES' ELSE 'NO' END AS ID_Value,
I only have access to 2008 right now, but I'd hope that this syntax would still work in 2005 (seems like something that would be part of the original definition of CASE).
CASE WHEN (ID IS NULL) THEN 'YES' ELSE 'NO' END AS ID_Value
Sign up using Google
Sign up using Facebook
Sign up using Stack Exchange
By posting your answer, you agree to the
terms of service.
10 months ago