sql server - SQL Table not locked even using tablock & holdlock -
sql server - SQL Table not locked even using tablock & holdlock -
i using sql lock on table. here query:
set transaction isolation level serializable go begin transaction select * emp waitfor delay '00:00:40' rollback transaction
now, when seek access table 'emp' somewhere else (by opening query analyzer , firing select query on emp table), still data. should not homecoming data, table locked 40 seconds.
note: i'd tried "with (tablock,holdlock)" , still not working.
how can create table inaccessible 40 seconds???
i had got answer
set transaction isolation level serializable go begin transaction select * emp (tablockx,holdlock) waitfor delay '00:00:40' rollback transaction
it locks table, no 1 else can access thenafter 40 seconds.
sql sql-server database
Comments
Post a Comment