BIT Primary Key

  • Hugo Kornelis (1/29/2013)


    wolfkillj (1/29/2013)


    (And yes, I know I spelled DR0P TABLE with a zero instead of an "O". In posting on this forum, I have discovered the my employer seems to have some kind of security filter that blocks outgoing web traffic that includes certain SQL statements. If I spelled DR0P TABLE correctly, that filter would catch this post and return a message that my machine is unable to communicate with the server.)

    *lol* This sounds like someone read the famous "Bobby Tables" cartoon[/url] - and then completely misunderstood it! *lol*

    "Little Bobby Tables" is very well known around here, so I don't think that's the problem. Plus, the filter catches outgoing content. The filter only seems to catch certain T-SQL statements, though. I'll have to ask the sysops or infosec guys about this next time I'm in their end of the building.

    Jason Wolfkill

  • Thanks for the question. Glad I was right on it.

    Also thanks to demonfox and others for the further details into the refresher on the bit data type



    --Mark Tassin
    MCITP - SQL Server DBA
    Proud member of the Anti-RBAR alliance.
    For help with Performance click this link[/url]
    For tips on how to post your problems[/url]

  • Nice easy question, with a bonus discussion about one-row tables. 🙂

    On the second thought, the table in the question allows 0 or 1 rows, while Hugo's example ensures that the table, once the first row is inserted, will always have exactly 1 row.

  • Nice one. I noticed the bit data type, but wasn't even thinking about binary vs decimal. Doh.

    And I even told someone today the line I stole from (sorry can't remember at the moment whoit belongs to) someone's sig line: "There are 10 types of people ...." Need more rest. 🙂

    [font="Verdana"]Please don't go. The drones need you. They look up to you.[/font]
    Connect to me on LinkedIn

  • Nice Question..

    Thanks..

  • Easy one. And greats Hugo Cornelis's contributions.

  • Nice easy one..

    Thanks

  • Great, sneaky question.

    😛

    Thanks a lot.

  • Lokesh Vij (1/28/2013)


    Easy question for the day!

    I agree with the explanation by "demonfox", here is the BOL link for BIT datatype:

    http://msdn.microsoft.com/en-us/library/ms177603.aspx

    It clearly says "any non-zero value will be converted to 1". I could not find the concept of the number being converted into binary and than getting truncated. Can anyone pour some light on what is happening internally?

    +1

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • Good and Easy one

  • Nice question Thomas! I'm seeing more references to SQL check constraints out on the Interwebs than I remember in the past.

    Cheers,

    Andre Ranieri

  • interesting

    not useful but interesting

Viewing 12 posts - 31 through 42 (of 42 total)

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