How to put NO LOCK for stored procedure T-SQL for all tables

sql, sql-server, t-sql

Solution

You can set this at the query level:

SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED

Like NOLOCK, this allows for dirty reads.

Problem

I want that my tables will not be locked. Is it possible to set NO LOCK for all tables in the stored procedure. What is the best way if I have a lot of tables like this: ``` select * from t1 join t2 .. join t3 .. with (nolock) select * from t4 join t4 .. join t5 etc... with (nolock) ```

Original source