Solved

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

Posted on 2007-03-26
2
219 Views
Last Modified: 2012-08-14
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?
0
Comment
Question by:chuang4630
2 Comments
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 18793696
SELECT Case(intFiledForBit) WHEN 1 then 'True' WHEN 0 THEN 'False' END  as Boolean
FROM urTable
0
 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 500 total points
ID: 18796857
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
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

So every once in a while at work I am asked to export data from one table and insert it into another on a different server.  I hate doing this.  There's so many different tables and data types.  Some column data needs quoted and some doesn't.  What …
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video discusses moving either the default database or any database to a new volume.

759 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

19 Experts available now in Live!

Get 1:1 Help Now