• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 228
  • Last Modified:

Return bit - return replace with a specific word

I have a Bit column. How can I return "Black" if it is true and "White" if it is false?
  • 2
2 Solutions
Aneesh RetnakaranDatabase AdministratorCommented:
select case when bitColumn = '1' THEN 'Black' else 'White' END
Raja Jegan RSQL Server DBA & ArchitectCommented:
Hope this helps:

SELECT CASE WHEN ur_bit_column = 1 THEN 'Black' ELSE 'White' END as result
FROM ur_table

Replace ur_bit_column and ur_table names accordingly.
Raja Jegan RSQL Server DBA & ArchitectCommented:
    You typed so fast compared to me..
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now