I have verified this, and it is true that using a NOLOCK hint on a view referenced in a query will propagate the hint down to the tables contained in the view.
My question: Does this propagation of the NOLOCK hint force a view to recompile or not?
Microsoft SQL Server 2005Microsoft SQL Server
Last Comment
Aneesh
8/22/2022 - Mon
Aneesh
No it wont force a recompile
Brendt Hess
ASKER
You'll get the answer points - is there any reference for this, or is this from your own experimentation?
absolutely nothing to do with recompilation; you can test this by seting statistics io on
SET STATISTICS TIME ON
GO
SELECT * FROM Sales.SalesPerson WITH (NOLOCK) WHERE BusinessEntityID = 282
GO
first time when you run this, as with all the other statements there will be compilation, if you run that again, you can see the compilation time as 0.
Or you can use SQL Profiler, all you have to do is select the recompilation column, and run the statement