In Oracle is:
LOCK TABLE employees IN EXCLUSIVE MODE WAIT 10;
On employees table I have to do first delete and then insert.
LOCK TABLE employees ..
DELETE FROM employees ..
INSERT INTO employees ...
What is equivalent statement of LOCK in ms sql server ?
Thanks
Either the delete statement will succeed and lock the table exclusively, or it will fail (if a lock is already held by another connection).
BTW, it’s good practice to try and avoid such extreme exclusive locking. There are other less aggressive isolation levels that you might possibly be able to use with the same results.
See SET TRANSACTION ISOLATION LEVEL