Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Server @@Identity
Message
From
16/10/2001 17:23:20
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Client/server
Title:
SQL Server @@Identity
Miscellaneous
Thread ID:
00569312
Message ID:
00569312
Views:
64
Perhaps this is not the best place to post a SQL Server question, but here goes anyway...

In VFP, I commonly insert parent and child rows into tables by first generating a primary key value for the parent table and then using that as the foreign key value for the child rows. This way, of course, the child rows are properly related to the parent.

How is this done in SQL Server? That is, how do I generate the "Next ID" for the parent so that I can use that value when inserting the child records? I suppose the T-SQL @@Identity could be used, but isn't that scoped to the connection and therefore not guaranteed to be the unique when I actually insert the parent record?

TIA,
Alan
Next
Reply
Map
View

Click here to load this message in the networking platform