>Thank you Michelle and Ed for your help.
>
>Michelle, when I type in GETKEYNO('tablename') in the default value of the primary key... in place of where you typed in 'tablename', do I put the name of the table the primary key is in? It is that simple?
>
>It seems a lot easier your way than the way than having to create a stored proceedure and a sysinfo table
>
>Jason
You still need the procedure and table. This way just automatically uses your procedure.
The way I do it, I have a table with keyname and keynum. Keyname is the table name (it can be whatever you want) and keynum is the last key used. I have a procedure "getkey()" that takes in the table name, finds it in the keylist table, adds one to the keynum and returns the new number.
By putting getkey('trips') as the default for the pk of the trips table, whenever I append or insert a new record, it automatically runs my procedure and fills in the key.
-Michelle
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only