Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2004
    Location
    Durban - South Africa
    Posts
    13

    Question Unanswered: Alphanumeric Autonumber Primary Key

    Hi there,
    The age old question of creating a unique alphanumeric value automatically like ABC0001, ABC0002

    Is it possible to do this automatically? That is, without having to update it which will slow the db down horribly?
    TrevorW
    If at first you don't succeed, call it version 1.0

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    the only sane way of doing it is to have an ordinary integer identity column, then produce the alphanumeric value in a view

    create view myview as
    select 'ABC'+right(cast(pkey as varchar(9)),4) as myalnumkey ...
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Feb 2010
    Posts
    1

    vb.net code to increment alphanumeric primary key

    Please help to get code for above

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by nikitacruise View Post
    Please help to get code for above
    no

    this thread is over 5 years old

    if you have a problem, please start a new thread
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  5. #5
    Join Date
    Jan 2010
    Posts
    18
    I may be being thicker than usual, but why would you want an alphanumeric auto increment key?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •