Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Stored procedure for generating primary keys
Message
From
28/07/2004 11:19:45
 
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00928674
Message ID:
00928731
Views:
25
Thanks for the reply!

So you would recommend using the identity field/property in SQL Server and then call @@identity to retrieve the key for processing?

Thanks for the help!

Greg

>Hi Greg,
>
>See Re: Incrementing the Primary Key Message #650887.
>BTW, your concern about identity field producing duplicates is unfounded.
>
>>I'm upsizing an online order system from FoxPro to SQL Server. Currently I have an ID table in Foxpro that maintains a record for each table and the next unique key. A method in Foxpro locates the appropriate table, locks the record, increments the key, unlocks the record, then returns the unique key. Very straight forward.
>>
>>Now in upsizing to SQL I believe I want to create a stored procedure to do the same thing. I don't really want to go with the identity auto-increment stuff in SQL. My main concern in writing this is making sure there is no possibility of getting a duplicate key.
>>
>>Does anyone happen to have or know where I could find SQL Server stored procedure code to do something like this? Any alternative recommendations?
>>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform