Reputation: 440
I have simple MSSQL query:
SELECT tw_todo as td FROM tw__work
where td gives me bit values like T or F (True/False).
Is there a way to translate this values to 1 or 0 inside this query?
Upvotes: 0
Views: 51
Reputation: 7965
SELECT CASE WHEN tw_todo = 'T' THEN 1 ELSE 0 END as td FROM tw__work
Try above query.
Here I had used CASE WHEN
which will convert 'T' and 'F'
to 1 and 0
Upvotes: 2
Reputation: 752
SELECT CASE tw_todo WHEN 'T' THEN 1 WHEN 'F' THEN 0 ELSE 0/0 END as td FROM tw__work
Upvotes: 1