Uniqueidentifier datatype as like identity function???

  • Hi,

    Is it possible to create a uniqueidentifier datatype column as increment by 1 as like identity function. For example, i have an int column type. In that i mentioned identity for that int datatype. So it will be display as 1,2,3,4,.....

    Likewise it is possible in uniqueidentifier datatype???

    For Ex,

    1,25EE8EBB-DFAD-450D-BE8B-1A3F1E2568C1,'Test1'

    2,25EE8EBB-DFAD-450D-BE8B-1A3F1E2568C2,'Test2'

    3,25EE8EBB-DFAD-450D-BE8B-1A3F1E2568C3,'Test3'

    ---

  • Hi,

    It is certainly possible to create a GUID using NEWID() and then appending a sequential number to it; can I ask what the requirement is for this though as a GUID is supposed to be exactly that, globally unique? :crazy:

    Although it's not guaranteed to be unique there are 3.4×10^38 combinations.



    Ade

    A Freudian Slip is when you say one thing and mean your mother.
    For detail-enriched answers, ask detail-enriched questions...[/url]

  • It is possible in SQL 2005 to create a GUID field with NEWSEQUENTIALID() default value.

    NEWID() is random.

  • There is a privacy warning in BoL for this function

    If privacy is a concern, do not use this function. It is possible to guess the value of the next generated GUID, and therefore access data associated with that GUID.



    Ade

    A Freudian Slip is when you say one thing and mean your mother.
    For detail-enriched answers, ask detail-enriched questions...[/url]

  • There is a privacy warning in BoL for this function

    I am wondering that there is no privacy warning in BOL about identity... If with GUID I can only "quess" the next value, with identity I can predict it... 🙂

    GUID are identifiers. If privacy is a concern do not return GUID back to the client application.

  • Glen (9/23/2008)


    I am wondering that there is no privacy warning in BOL about identity...

    It's not about identity, it's specifically about NEWSEQUENTIALID().

    http://msdn.microsoft.com/en-us/library/ms189786(SQL.90).aspx



    Ade

    A Freudian Slip is when you say one thing and mean your mother.
    For detail-enriched answers, ask detail-enriched questions...[/url]

  • Hi Guys,

    Thanks you for your valuable reply's. Because of Performance Issue, i am think about this. So that it will be in sequence when i am inserting or updating a row again in the same table. Obviously i agree still we have to change our Procedure against this Performance Issues. But this also one criteria which we need to lookup. Please get back to me if my thinking goes wrong.

    ---

  • Obviously i agree still we have to change our Procedure against this Performance Issues

    Sorry, your original question didn't state anything about performance issues.

    I am using uniqueidentifiers (GUID) with newsequentialid default values on my tables and do not see "performance issues"...

Viewing 8 posts - 1 through 7 (of 7 total)

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