September 4, 2013 at 12:38 am
Please help to write the SQL query in a more cleaner way...
CASE ISNULL(TCBOV.cboValueName, '') WHEN '' THEN ''
ELSE TCBOV.cboValueName
END
Thanks
September 4, 2013 at 12:57 am
Junglee_George (9/4/2013)
Please help to write the SQL query in a more cleaner way...CASE ISNULL(TCBOV.cboValueName, '') WHEN '' THEN ''
ELSE TCBOV.cboValueName
END
Thanks
You don't have to use a CASE statement for this, just a ISNULL or COALESCE within the SELECT.
SELECT ISNULL(TCBOV.cboValueName, '')
September 10, 2013 at 1:29 am
I agree, I would use a COALESCE statement.
September 11, 2013 at 6:29 pm
If you need to handle another condition along with NULL, you may write something like
CASE
WHEN TCBOV.cboValueName IS NOT NULL THEN
CASE TCBOV.cboValueName
WHEN 10 THEN 'Value1'
WHEN 20 THEN 'Value2'
ELSE TCBOV.cboValueName
END
ELSE 'No Value'
END
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy