If the requested table is locked by any other transaction then you can make use of NOWAIT in SQL server.
SYNTAX
SELECT * FROM TABLE_NAME WITH (NOWAIT)
EXAMPLE
SELECT * FROM StudentMarks WITH (NOWAIT)
If the requested table is locked by any other resources then the following error message will appear
Msg 1222, Level 16, State 45, Line 2
Lock request time out period exceeded.
From the above message we can identify that the table is locked by other resources, So that you can wait for sometime to read the data.
No comments:
Post a Comment