Wednesday, April 12, 2017

Will the linked server honor the NOLOCK hint?

Will the linked server honor the NOLOCK hint? -No
Ex:
INSERT INTO  CallHistory
SELECT *  FROM LINKSERVER.DATABASE.DBO.CallHistory WITH(NOLOCK)WHERE callplacedtimeUTC >= DATEADD(hh,-4,GETUTCDATE())  ORDER BY callplacedtimeUTC DESC
linked server do not  honor the NOLOCKso Create a view like below 
 Create view test
as
SELECT *  FROM  DATABASE.DBO.CallHistory WITH(NOLOCK)WHERE callplacedtimeUTC >= DATEADD(hh,-4,GETUTCDATE()) 

and then Finally:INSERT INTO  CallHistory
SELECT *  FROM LINKSERVER.DATABASE.DBO.test  --view  ORDER BY callplacedtimeUTC DESC

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...