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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only