Script to auto-generate alphanumberic numbers

  • Hi,

    I'm new to sql server.

    if anybody has a script to auto-generate alphanumeric like

    AAA1000

    AAA1001

    AAB1002

    etc..

    Thanks in advance,

  • It's not hard to do, but you are going to have to define the sequence that you want better.

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • say the first few either 3 or five are characters and the rest are numeric. and increasing and this will be the primary key for the table

    -viji

  • deviji2000 (8/27/2008)


    say the first few either 3 or five are characters

    Alphabetic(A-Z) characters or Alphanumeric(0-9,A-Z)?

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • The rules for incrementing need to be defined.

    What condition causes AAA1001 to increase to AAB1002? The number part, in your example, seems to go up by one each row. That part is easy. What causes the letter part to go up? That's not clear from the example you gave.

    - 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

Viewing 5 posts - 1 through 4 (of 4 total)

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