T-SQL reference › bit
bit in SQL Server: 0, 1 and NULL
bit is SQL Server’s yes/no. It stores 0, 1, or NULL. SSMS often shows it as a checkbox. Reports still want a word.
Label it for a human
SELECT product_name,
CASE WHEN is_discontinued = 1 THEN 'Yes'
WHEN is_discontinued = 0 THEN 'No'
ELSE 'Unknown' END AS discontinued
FROM Products;
WHERE is_discontinued = 0 does not include NULL. If the flag was never set, those rows vanish. Say whether unknown counts as no.
Try it on Harbour & Co
Amy Nair (Finance Lead) needs this now: “Can I get a customer contact list? Just first name, last name and email.” Write the query, run it, send the results. Free.
Take the ticket →Learn it on a real ticket
Monday is free on WorkSQL. A colleague’s ticket lands, you write the T-SQL, we mark it. No videos. Five minutes.
Clock in free See Monday’s tickets