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

Posted on 2007-10-16
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)).

Question by:OddiC
    LVL 75

    Expert Comment

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

    SELECT @i = 'true'
    SELECT @i
    LVL 75

    Accepted Solution

    the same code wont work in sql 2000

    Author Comment

    Awesome- thanks Aneeshattngal

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
    Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
    Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
    In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

    760 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

    12 Experts available now in Live!

    Get 1:1 Help Now