Essentially I'm trying to do this
select u.Hostname, u.IsCustom, (u.Status = 5) as IsActive from SiteUrlMappings u
Where 5 is an int representing an "Active" url.
Of course this doesn't work, and my sql is rusty like an old screwdriver.
You don't need a CASE expression
Just leverage how bit
works: all non-zero values give 1 when cast to bit
SELECT u.Hostname, u.IsCustom, ~ CAST((u.Status - 5) AS bit) AS IsActive from SiteUrlMappings u
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