MS SQL Server:(NOWAIT) Vs (NOLOCK) Hints

Purpose:

The purpose of this post is to explain the basic difference between two hints i.e.(NOWAIT) Vs (NOLOCK) in microsoft SQL server.

SELECT * FROM INVENTTABLEDWH WITH (NOLOCK)

SELECT * FROM INVENTTABLEDWH WITH (NOWAIT)

(NOLOCK) hint will able to read the data even if transactions are locked.Transactions can be locked due to any update or delete query.Select query with (NOLOCK) hint can return invalid or dirty data as it will fetch records even if transactions are locked.

(NOWAIT) hint will able to read the data even if transactions are locked but return you an error.

 

Leave a Reply