Results 1 to 2 of 2
  1. #1
    Join Date
    May 2012
    Posts
    17

    Unanswered: Populate a field by concatenating primary

    Assume a table with
    - Primary key field (Integer, pk, NN, AutoInc), let's call it recnbr
    - A char(6) field, let's call it CustId
    I want on insert/record creation to automatically populate CustId by concatenating the letter 'c' and the pk value like this:
    recnbr CustId
    1 -----> c1
    2 -----> c2
    3 -----> c3
    ...
    265 ---> c265
    266 ---> c266
    etc...
    I tried a trigger, but seems can't use an Update with After Insert. Is there a way to achieve the above? Thanks.

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Why would you
    By doing so you either duplicate data or loose the primary key. Neither ofwhich is a smart call
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

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