Convert Boolean To String

Posted on 2005-05-09
Last Modified: 2007-12-19
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.
Question by:eternal_21
    LVL 28

    Expert Comment


    CASE [BoolColumn] WHEN 1 THEN 'Yes' ELSE '' END AS Expr1
    LVL 28

    Accepted Solution


    CASE WHEN [BoolColumn] = 1 THEN 'Yes' ELSE '' END AS Expr1
    LVL 10

    Author Comment

    The latter worked perfectly.  Thank you rafrancisco for your quick response.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    Introduction In my previous article ( I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
    Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
    This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
    Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now