Solved

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

Posted on 2007-03-26
2
252 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 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Introduction This article will provide a solution for an error that might occur installing a new SQL 2005 64-bit cluster. This article will assume that you are fully prepared to complete the installation and describes the error as it occurred durin…
INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

749 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