Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LOCKING ISSUE

Status
Not open for further replies.

svagelis

Programmer
May 2, 2001
121
GR
I have one table that contains 3 columns (ID,Index,Desc)
I use this table to collect Index and Desc in order to
make a primary key to another table.After i collect index and desc , i increase the value of Index by one.
What i want is to ensure that while i m reading Index , inserting record to another table and increase index , no other user will read index and got the same value as i got.
Is there a way to prevent others from reading index while i m doing this job?
Thanks!!
 
You want to put a BEGIN TRANSACTION and a COMMIT TRANSACTION around your SQL code that updates one table, then takes the value from there and updates another table. And a ROLLBACK TRANSACTION on an error condition. Brian J. Alves
Terrier Consulting, Inc.
Email: brian.alves@worldnet.att.net
VB / Crystal / SQLServer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top