Avatar of Brendt Hess
Brendt Hess
Flag for United States of America asked on

Does NOLOCK on a view force a recompile?

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

Avatar of undefined
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?
ASKER CERTIFIED SOLUTION
nicde

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Brendt Hess

ASKER
Thank'ee much!
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Aneesh

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
Aneesh

You should have split the points...