Bit data

  • Comments posted to this topic are about the item Bit data

  • The question did not mention SQL 2005.

    My answer was for SQL 2000.

    Oh well.

  • hi

    i am using sql 2000, then the answer is wrong

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

  • 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

  • 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

  • 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

  • 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.

  • True.

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

    ):-D

  • 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.

    😎

  • 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

  • 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

  • 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

  • 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

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

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

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