Bit data

  • Dr. Diana Dee

    SSCarpal Tunnel

    Points: 4232

    Comments posted to this topic are about the item Bit data

  • Bill Mell

    SSCommitted

    Points: 1621

    The question did not mention SQL 2005.

    My answer was for SQL 2000.

    Oh well.

  • shamshudheen

    SSCrazy

    Points: 2390

    hi

    i am using sql 2000, then the answer is wrong

  • jim.powers

    SSCrazy Eights

    Points: 8700

    The question does specifically request the results from SQL Server 2005.

  • webrunner

    SSC-Dedicated

    Points: 30227

    jim.powers (5/7/2008)


    The question does specifically request the results from SQL Server 2005.

    Yes, it does.

    What will be the result when the following query is executed on SQL Server 2005?

    Also, and this depends on knowing the sample databases, but AdventureWorks is one of the new sample databases for SQL 2005.

    Reference:

    http://blog.sqlauthority.com/2007/05/23/sql-server-2005-northwind-database-or-adventureworks-database-samples-databases/[/url]

    -------------------
    A SQL query walks into a bar and sees two tables. He walks up to them and asks, "Can I join you?"
    Ref.: http://tkyte.blogspot.com/2009/02/sql-joke.html

  • Dr. Diana Dee

    SSCarpal Tunnel

    Points: 4232

    I was very careful to specify SQL 2005 because SQL 2000 behaves differently.

    I was inspired to post this question because one of my students used WHERE = 'true' for a bit column. I tested that in SQL 2000 and it did not work, so I told the student he was wrong. However, when I tested that in SQL 2005, it worked.

    I was not trying to trick anyone, since I explicitly specified SQL 2005, and found an example from the AdventureWorks database.

    ):-D

  • GSquared

    SSC Guru

    Points: 260824

    It's a good question and gives all the necessary information.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • SanjayAttray

    SSChampion

    Points: 13157

    WHERE SalariedFlag = 'true' for bit would not work in 2000 but since it says use Adventureworks, it clear that the question is for SQL 2005.

    SQL DBA.

  • Dr. Diana Dee

    SSCarpal Tunnel

    Points: 4232

    True.

    And I explicitly said "2005" in the body of the question.

    ):-D

  • Lynn Pettis

    SSC Guru

    Points: 442312

    Just a problem with some people not reading the entire question. The question did specifically state SQL Server 2005.

    Good question, everything specified to be able to make an educated guess at the answer.

    Well done.

    😎

  • Dr. Diana Dee

    SSCarpal Tunnel

    Points: 4232

    Thank you.

    I myself have trouble noticing everything in the questions! (LOL)

    I did give an AdventureWorks example so people could actually test for the result.

    ):-D

  • kk-479046

    Right there with Babe

    Points: 763

    Good Question Dr.Dee! I guess writing our queries like SalariedFlag = 'TRUE' makes it more readable. But I wonder if there would be any performance degrade when we use 'TRUE' instead of 1?

    KK

  • Dr. Diana Dee

    SSCarpal Tunnel

    Points: 4232

    I suppose one could test whether the implicit conversion has a cost by creating a table with several million rows and running the query each way.

    Unfortunately, I'm too busy (translation: I don't care enough!)

    ):-D

  • Christian Buettner-167247

    SSChampion

    Points: 13729

    Good Question!

    Although I doubt that this new implicit conversion is an improvement for SQL Server.

    I would be interested to know why they have not allowed TRUE or FALSE as bool keywords so far.

    Does anyone know if this is a technical restriction?

    (But at least they (TRUE and FALSE) have been reserved as "FUTURE KEYWORDS")

    Best Regards,

    Chris Büttner

  • Anipaul

    SSC-Insane

    Points: 24681

    Another goodie...............:)

Viewing 15 posts - 1 through 15 (of 22 total)

You must be logged in to reply to this topic. Login to reply