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!

record lock

Status
Not open for further replies.

Saturn57

Programmer
Aug 30, 2007
275
CA
I have a recordlock field in a table and I would like to know if there is a feature in sql that will allow me to take advantage of this field to lock the record from being altered in any attached applications.
 
No. You will have to handle that on the front end by not allowing the user to edit th record or not show the record at all.
 
This is suggested in another forum:

-- Will hold a lock on a record until COMMIT is issued. Exec 1 line at a time in SMSS


BEGIN TRANSACTION

SELECT SomeColumn FROM dbo.MyTable WITH (TABLOCKX) WHERE SomeCriteria

(Now run application code against locked record)

COMMIT -- Releases lock
 
Write an 'Instead of Update trigger' on the table.

[pipe]
Daniel Vlas
Systems Consultant

 
How do you write an instead of update trigger?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top