Unique Id

  • How do you create unique identifier such as U82300001 ,U82300002 and U82300003 etc to autogenerate for each row

  • You could use an identity column and a calculated column that adds a "U" to the beginning of the number. Will that accomplish what you need?

    - 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

  • I have to ask why the U is mandatory.

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • The reason why ,I have to use u is because my supervisor made request for the apppointment number format to start off with U

  • I agree with Gus. Your simplest approach is to simply use an identity column and add the "U" when the number is displayed to your supervisor's application. You can easily create a view that will handle this for you, or go with the calculated column Gus suggested.

    Alternatively, you might discuss this with your supervisor in advance and see if he can live without the "U". Is it a status flag, or a grouping indicator of some sort? In other words, are you going to have to do increments like this?

    U2000300001

    U2000300002

    U2000300003

    .

    . ( then start over with )

    .

    X2000300001

    X2000300002

    X2000300003

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Ever thought about the datatype "'UNIQUEIDENTIFIER" ?

    Wilfred
    The best things in life are the simple things

  • Wilfred van Dijk (8/5/2009)


    Ever thought about the datatype "'UNIQUEIDENTIFIER" ?

    The reason why ,I have to use u is because my supervisor made request for the apppointment number format to start off with U

    Hello I'm here for my appointment, my appointment number is B5010D2A-F8F9-482B-AC29-C1351ECE52CB :w00t:

  • "Let me see ... seems your for an amputation of your left leg?"

    "No ?? .... Aha! My appointment is B5010D2A-F8F9-482B-AC29-C1351ECE52C8"

    "Oh yes, you're pregnant, let's see how the baby is doing"

    :-D;-)

    Wilfred
    The best things in life are the simple things

  • Wilfred van Dijk (8/5/2009)


    "Let me see ... seems your for an amputation of your left leg?"

    "No ?? .... Aha! My appointment is B5010D2A-F8F9-482B-AC29-C1351ECE52C8"

    "Oh yes, you're pregnant, let's see how the baby is doing"

    :-D;-)

    My appointment is B5010D2A-F8F9-482B-AC29-C1351ECE52C8

    Ah yes sir, the DBA will see you straight away:-)

  • No, no, no... B5010D2A-F8F9-482B-AC29-C1351ECE52C8 is my NAME. My friends call me BR-542.

    My appointment is 45DF88B8-C798-45DC-8E8D-4898172DB091.

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

Viewing 10 posts - 1 through 9 (of 9 total)

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