Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Best way to generate PK on SQL table
Message
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00459598
Message ID:
00459768
Views:
27
>Do you create the GUID with a row global unique identifier column in SQL using NewId() as the default value for the field? If so, how do you retrieve the value of this field when a new record is inserted?
>
>Thanks,
>Doug
Doug,
PMFJI, but you could create a candidate key and use it to retrieve the PK. If you didn't want to go that route for replication reasons (or whatever), you could call the NewID() function manually via SQL Pass-thru and use it instead of the Default value.
=sqlexec(lnconn,"select newid() as pk","c_temp")
lcpk = c_temp.pk
=sqlexec(lnconn,"insert into table1 values (?lcpk)")
HTH.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Reply
Map
View

Click here to load this message in the networking platform