Nix Neon
|
| Posted: 03/11/2003, 11:44 AM |
|
I have a database on my AS400 called employee file. I can view this, edit, add to it. With the exception of the primary key. How do I allow for the updating or adding of the primary key?
|
|
|
 |
RonB
|
| Posted: 03/12/2003, 4:42 AM |
|
Primary keys seldom change. They are often used in other tables as reference to a record. If you'd change the primary key in table a you run the risc that in table b the reference to a record in table a is lost.You would create the nightmare of every DBA... data inconsistency!!
CCS almost always handles the primary key and often the database used has some mechanism for making sure the key stays unique(autoincrement etc.
If you have to fool around with the primary key I'd stick to inserts and forget updating unless you are prepared to do a lot of event coding making sure the changed value for the key gets changed in all tables that hold this key as a reference. Even with inserts it's good practice to do a check when the primary key is not a auto-increment field or doesn't use a sequence(oracle) to generate the key.
If you include the primary key in the record grid you can change or insert new ones.
Ron
|
|
|
 |
|