Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Quick, (easy?) question about SQL bit data type..

Posted on 2007-10-16
3
Medium Priority
?
199 Views
Last Modified: 2010-03-19
Hi all,

I'm just wondering for piece of mind-

I recently was developing an application and, when working in my dev environment (dev db), I was able to pass in varchar values of 'true' and 'false' to a bit column. This worked fine, however, when I moved to production I would get an error saying SQL could not convert the varchar values to a bit value. Hmmm. Wasn't a huge problem- I just changed the values to 1 and 0 for true and false.

I guess my question is- why would this occur in on different SQL Servers? Is there a Serer setting, or is this due to different versions? I was just wondering why this was the case..

Thanks in advance! (I'll be happy to give points to the best response(s)).

-oddic
0
Comment
Question by:OddiC
  • 2
3 Comments
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 20087014
in sql server 2005 you can pass true/false

DECLARE @i BIT
SELECT @i = 'true'
SELECT @i
0
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 2000 total points
ID: 20087018
the same code wont work in sql 2000
0
 

Author Comment

by:OddiC
ID: 20087062
Awesome- thanks Aneeshattngal
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

572 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