In the database I am creating a table that houses “subjects’ names” and their “unique IDs”, which are both indexed with no duplicates. The Unique ID is used as a FK to connect all the tables that contain information from the subject. When subjects are enrolled in one of our studies they are assigned a “Unique ID”, which is assigned sequentially. The IDs are alphanumeric, and consists of 4 characters with the first character being a letter:
A001, A002…A999, B001, B002…C001 etc.:
To help avoid data entry errors, I would like to automate the process of assigning these Unique IDs as much as possible. So my question is:
Is it better to manually insert all the possible Unique IDs into this table upfront and then use a code that allows the user to assign the next Unique ID to the subjects they are enrolling (ie search the subject names column for the first null field and enter value there)? Or would it be better to set up a code that looks through the IDs that are already in the list and then automatically generates and assigns the next sequential ID to the person they have entered.
Also, where might I find some pre-established code to get me heading in the right direction?
Thanks in advance!
A001, A002…A999, B001, B002…C001 etc.:
To help avoid data entry errors, I would like to automate the process of assigning these Unique IDs as much as possible. So my question is:
Is it better to manually insert all the possible Unique IDs into this table upfront and then use a code that allows the user to assign the next Unique ID to the subjects they are enrolling (ie search the subject names column for the first null field and enter value there)? Or would it be better to set up a code that looks through the IDs that are already in the list and then automatically generates and assigns the next sequential ID to the person they have entered.
Also, where might I find some pre-established code to get me heading in the right direction?
Thanks in advance!