primary key - tag numbers

From: tretasdehr <tretasdehr_at_yahoo.co.uk>
Date: 23 Feb 2003 07:46:11 -0800
Message-ID: <cc15b354.0302230746.5a9abfe5_at_posting.google.com>



In a database of animals at a large shelter, the tag number of the animals can be large, but it will still need to be repeated after about 2 years. That is, the tag number will be used again.

If the tag number is to be used as the primary key in a (SQL) database that has to preserve its records for legal reasons, what is the best way to keep the primary key unique and prevent it from repeating with the re-use of the tag number?

Could it just be prefixed by the last 2-3 years of the date, eg 02--- or 002--- ? Since that would be tedious to write every time, can this year information prefix be entered automatically in a SQL database, so that all the user needs to do is to enter the actual tag number? That is, if the user enters a number like 40023 then in the actual database, that is recorded as 00240023. However, when it is recalled, it is just shown as 40023. Received on Sun Feb 23 2003 - 16:46:11 CET

Original text of this message