Thursday, August 18, 2016

NOLOCK will propagate to the tables used by the view definition

USE AdventureWorks2008R2;
GO
CREATE VIEW EmployeeName AS
SELECT h.BusinessEntityID, p.LastName, p.FirstName
FROM HumanResources.Employee AS h With  
JOIN Person.Person AS p  
ON h.BusinessEntityID = p.BusinessEntityID;
GO


--select from view
SELECT * from EmployeeName WITH (NOLOCK)



 NOLOCK will propagate to the tables used by the view definition 

No comments:

Post a Comment

https://blog.sqlauthority.com/2009/06/27/sql-server-fix-error-17892-logon-failed-for-login-due-to-trigger-execution-changed-database-context...