ROWGUIDCOL

  • Comments posted to this topic are about the item ROWGUIDCOL

    M&M

  • Good question ... thanks

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • Thank you Ron. Seems to be easy, most of them got it right 🙂

    M&M

  • mohammed moinudheen (3/7/2011)


    Thank you Ron. Seems to be easy, most of them got it right 🙂

    Not necessarily a bad thing - it means people have understood the question and what it is asking, for a start.

    Thanks for the question, I learned something new.

    Duncan

  • Thank you Duncan for the feedback.

    M&M

  • Nice and easy, thank you very much.

    (Easy is not a bad thing, it is good for one's self esteem that it is not necessary to dive into BOL to find an answer :-))

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • mohammed moinudheen (3/7/2011)


    Thank you Ron. Seems to be easy, most of them got it right 🙂

    Only 80% at the moment.

    I'm intrigued about the 2% who answered "2" 😉

  • Toreador (3/8/2011)


    mohammed moinudheen (3/7/2011)


    Thank you Ron. Seems to be easy, most of them got it right 🙂

    Only 80% at the moment.

    I'm intrigued about the 2% who answered "2" 😉

    Almost as intriguing is the 5% who answered "0" - maybe they thought it was a trick question?!!

  • Great question. Easy is nice for many reasons.

    I can't be the only one appreciating the easy questions on Fat Tuesday.

    I wonder if the 5% that answered 0 thought is was about the query optimizer?:w00t::-P:w00t:

  • Interesting question.

    There is however a problem with use of imprecise English - this is of course sheer nit-picking, and I'm not complaining because I guessed that the chances were better than even that imprecise English was being used so that I got it "right" by deliberately selecting an answer I knew to be wrong.

    The right answer of course is "each of them can (but only one at a time)" so of the options provided 3 is closest to correct. 1 (the "right" answer) would only be really correct if the question was "how many of them can be rowguidcol columns at the same time".

    Tom

  • Tom.Thomson (3/8/2011)


    Interesting question.

    There is however a problem with use of imprecise English - this is of course sheer nit-picking, and I'm not complaining because I guessed that the chances were better than even that imprecise English was being used so that I got it "right" by deliberately selecting an answer I knew to be wrong.

    The right answer of course is "each of them can (but only one at a time)" so of the options provided 3 is closest to correct. 1 (the "right" answer) would only be really correct if the question was "how many of them can be rowguidcol columns at the same time".

    You are right, it is sheer nit-picking 🙂

    However, it does not make your point less valid...

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Tom.Thomson (3/8/2011)


    The right answer of course is "each of them can (but only one at a time)" so of the options provided 3 is closest to correct. 1 (the "right" answer) would only be really correct if the question was "how many of them can be rowguidcol columns at the same time".

    I have to agree to disagree with this statement.

    "enabled" is the key word in this question and makes perfect english as the last word in the question. This makes it the main describer for the question.

    You can "enable" ROWGUIDCOL on any UID column in a table, but it can only be "enabled" on one row.

    When something is done and the switch is on it is enabled.

    The concept I learned from the question is that enabling ROWGUID on any column automaticly disables it on all other columns when using Table Designer.

    When being done from a script the DDL you have to use to make another column the ROWGUIDCOL really brings home why the question makes perfect sense.

    Create a table called Table_1 give it three UID columns and set the first or second one to ROWGUID.

    CREATE TABLE [dbo].[Table_1](

    [uid01] [uniqueidentifier] ROWGUIDCOL NULL,

    [uid02] [uniqueidentifier] NULL,

    [uid03] [uniqueidentifier] NULL

    ) ON [PRIMARY]

    ALTER TABLE [dbo].[Table_1] ADD CONSTRAINT [DF_Table_1_uid01] DEFAULT (newid()) FOR [uid01]

    ALTER TABLE [dbo].[Table_1] ADD CONSTRAINT [DF_Table_1_uid02] DEFAULT (newid()) FOR [uid02]

    ALTER TABLE [dbo].[Table_1] ADD CONSTRAINT [DF_Table_1_uid03] DEFAULT (newid()) FOR [uid03]

    GO

    Now try to Alter the table and set any other column to ROWGUID.

    ALTER TABLE dbo.Table_1 ALTER COLUMN uid02

    ADD ROWGUIDCOL

    GO

    It can't be done because ROWGUIDCOL is already enabled on another COLUMN and it can only be enabled on ONE column. This looks really wierd when using the querry designer becuase it will let you select YES to the option on any column, but it is only enabled on the last one you pick.

    Try it out.

    BEGIN TRANSACTION

    ALTER TABLE dbo.Table_1 ALTER COLUMN uid03

    DROP ROWGUIDCOL

    GO

    ALTER TABLE dbo.Table_1 ALTER COLUMN uid02

    ADD ROWGUIDCOL

    GO

    COMMIT

    So lets read the qustion again:

    How many UID columns in a table can have ROWGUIDCOL enabled?

    You can enable it on any UID column in a table, but it can only be enabled on one column.

    One last thing to point out about ROWGUIDCOL property is that differant from an Identity Column, the Object explorer gives you no clues about which column has ROWGUIDCOL enabled.

  • I guess my question is, once you have a GUID, what is the point of the other unique columns?

  • nice and easy one..

  • Daniel Bowlin (3/8/2011)


    I guess my question is, once you have a GUID, what is the point of the other unique columns?

    I think there is no point in adding other unique colums. I just happened to read about GUID's and thought of this question.

    M&M

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

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