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

How to cast an int to be bit (True/False)?

The stored procedure that I am working on requires to return true/false when the field flag is (int) 1 / (int) 0
How do I do it?
1 Solution
Aneesh RetnakaranDatabase AdministratorCommented:
SELECT Case(intFiledForBit) WHEN 1 then 'True' WHEN 0 THEN 'False' END  as Boolean
FROM urTable
Anthony PerkinsCommented:
It depends on the fron-end language you are using.  With VB classic and .NET (VB or C#) you should be able to use a bit data type and it should interpret it as a boolean as in:

Select CAST(YourColumn as bit)
From YourTableName
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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

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