Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 12543
  • Last Modified:

Convert Boolean To String

I have a field of type bit, and it is storing true/false values.  I want to run a query against this table and convert this true/false to a "Yes"/"" string.

In Access I could use this: "IIf([BoolColumn],"Yes","") AS Expr1", but I can't get this to work in SQL.
0
eternal_21
Asked:
eternal_21
  • 2
1 Solution
 
rafranciscoCommented:
Try:

CASE [BoolColumn] WHEN 1 THEN 'Yes' ELSE '' END AS Expr1
0
 
rafranciscoCommented:
or:

CASE WHEN [BoolColumn] = 1 THEN 'Yes' ELSE '' END AS Expr1
0
 
eternal_21Author Commented:
The latter worked perfectly.  Thank you rafrancisco for your quick response.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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