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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to lock a Table

Status
Not open for further replies.

rajeshkanna

Programmer
Apr 24, 2002
9
IN
Hi all

Anyone can help me will be appriciable.

Is there a way to lock a table completely. No other persons to add/update or delete any arecords into that table until completing a stored procedure transactions.

Sql server 7.0 version.

Rajesh kanna. N

 
You have to use locking hints to do this. TABLOCKX takes an exclusive lock on the table, using either HOLDLOCK or SERIALIZABLE ISOLATION LEVEL whill keep the lock on for the duration of the transaction. Have a look in books online, useful information in there about locking hints.
 
Thanx jester777, TABLOCKX works fine. thanks lot

Rajesh Kanna. N
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top