Explicit locking of rows in a table, or of the entire table, is handled via "locking hints" in SQL Server. These hints may be placed in SELECT, INSERT, UPDATE, and DELETE statements and are added to the table(s) in the FROM clause, as, e.g:
Code:
SELECT * FROM MyTable WITH (TABLOCKX, HOLDLOCK)
WHERE ...
will acquire an exclusive lock (read and update lock) on the table and hold it until the transaction in which it resides is completed (committed or rolled back). See "table hints" in the BOL index for the list of the various hint values.
Jeff Mason
Custom Apps, Inc.
www.custom-apps.com