Dynamic SQL with EXEC is not using NOLOCK


hi all,

we executing query dynamically using exec. in query have used nolock, but  there no effect of nolock. there restriction in using nolock in dynamic sql exec.

will there positive result if use sp_executesql

please suggest


-- reddy balaji c. ##mark answer if solves issue

hi,

although it's recommanded use sp_executesql, nolock hint should work in dynamic sql in case, if use exec or sp_executesql.

see, if schema lock mentioned in below post reason,

http://blogs.msdn.com/b/sqlcat/archive/2011/02/20/concurrency-series-why-do-i-get-blocking-when-i-use-read-uncommitted-isolation-level-or-use-nolock-hint.aspx


- chintak (my blog)



SQL Server  >  Transact-SQL



Comments

Popular posts from this blog

Conditional formatting a graph vertical axis in SSRS 2012 charts

Register with Power BI failed

SQL server replication error Cannot find the dbo or user defined function........