Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Primary Key
Message
From
15/12/1998 10:01:10
 
 
To
15/12/1998 09:53:29
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00167667
Message ID:
00167681
Views:
15
>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
Map
View

Click here to load this message in the networking platform