Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Primary Key generation
Message
From
28/04/2013 02:45:56
Naeem Afzal
Syed Junaid Alam
Manama, Bahrain
 
 
To
25/04/2013 03:55:13
Naeem Afzal
Syed Junaid Alam
Manama, Bahrain
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
01571831
Message ID:
01572081
Views:
44
Hi All,

I did this by using a dummy table for holding exclusive lock by one user in a transaction before generating PK. Is there any performance issues with this in multiusers app?

Thanks
Naeem

>Thanks for your reply. I am using the following method to generate primary key

>Begin Transaction
Insert into dummytable (Transtat) values (1)

>SELECT PKTable
>RLOCK()
>Replace PK_Type_Field with PK_Type_Field + 1
>lnNewPK = PK_Type_Field

Insert into PKTable select Max(PK_Type_Field)+1 from PKTable

>* insert/update/etc
>* first Master table with lnNewPk
>* then Child table with lnNewPK

>SELECT PKTable
>UNLOCK

Insert into dummytable (Transtat) values (0)

>* Now Rollback / Commit
>END TRANSACTION

>if I use the identity column as my primary key then how can I generate my Alternate Key as the above. What is the T-SQL for above >code?

>TIA
Previous
Reply
Map
View

Click here to load this message in the networking platform