I have an attribute declared as bit: (true or false).
For example:
SELECT myBit FROM [table]
=> it will show: 1 or 0
I would like to show: 'Valid' and 'Invalid' for 1 and 0 respectively.
How could I add IF ELSE statement in the SELECT statement?
For SQL Server, you can use a CASE statement:
SELECT CASE myBit WHEN 1 THEN 'Valid' WHEN 0 THEN 'Invalid' END As MyColumn
FROM [table]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With