Arg81
Well-known member
Afternoon all,
Obviously my table has a Primary Key / ID field. This is currently set as varchar, as the user has to input this (it's not a simple identity integer field) - the field is called WO_No
What I need to know is can the following be done.
When a user enters the WO_No, I need it to check the DB to see if that WO_No already exists. If it does, it will then add a certain character to the end to create a new WO_No
For example:
User enters WO_No 12345 and fills out all other information. When they submit, the program checks, sees WO 12345 exists and submits using WO 12345A
If user enters WO_No 12345 again at a later date, the program checks, sees 12345 and 12345A and saves using 12345B .... etc etc.
Logically speaking, we would never have the need to go beyond 4 or 5 "sub" WO's (they are created when we break work on an existing WO to work on a new WO, then later come back to work on the broken WO)
Questions:
(a) Is this possible, or is it a pain to get the program to assign A,B,C,D,E..etc in that order
(b) Are there any alternatives
(c) Is this in fact not at programming level and is at SQL DB level such as an SP?
Thanks for any advice.
Obviously my table has a Primary Key / ID field. This is currently set as varchar, as the user has to input this (it's not a simple identity integer field) - the field is called WO_No
What I need to know is can the following be done.
When a user enters the WO_No, I need it to check the DB to see if that WO_No already exists. If it does, it will then add a certain character to the end to create a new WO_No
For example:
User enters WO_No 12345 and fills out all other information. When they submit, the program checks, sees WO 12345 exists and submits using WO 12345A
If user enters WO_No 12345 again at a later date, the program checks, sees 12345 and 12345A and saves using 12345B .... etc etc.
Logically speaking, we would never have the need to go beyond 4 or 5 "sub" WO's (they are created when we break work on an existing WO to work on a new WO, then later come back to work on the broken WO)
Questions:
(a) Is this possible, or is it a pain to get the program to assign A,B,C,D,E..etc in that order
(b) Are there any alternatives
(c) Is this in fact not at programming level and is at SQL DB level such as an SP?
Thanks for any advice.