How to apply an exclusive lock on a table while an insert is being made? In my case two different threads are inserting values into same table and they cannot see other transaction's data being inserted.
I want that while one transaction is inserting the rows, other transaction waits till first transaction has finished inserting the values.
Piece of SQL Trigger:-
BEGIN
insert into A(SETID,ACCTID,UPDATEDTM)
select @setid, l.acctid, getdate()
from AccountTable l where --(conditions for where clause)
I want to lock table A
for insert operations being done.