Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2007-03-26
2
Medium Priority
?
270 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 2000 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

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently, when I was asked to create a new SQL 2005 cluster, Microsoft released a new service pack for MS SQL 2005 what is Service Pack 3. When I finished the installation of MS SQL 2005 I found myself troubled why the installation of SP3 failed …
I've encountered valid database schemas that do not have a primary key.  For example, I use LogParser from Microsoft to push IIS logs into a SQL database table for processing and analysis.  However, occasionally due to user error or a scheduled task…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

670 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