1

Is there a speed benefit to using WITH (NOLOCK) in temporary variable assignment. Meaning:

This

DECLARE @oldestPerson INT = (SELECT TOP 1 Age FROM tbl_Persons)

Verses

DECLARE @oldestPerson INT = (SELECT TOP 1 Age FROM tbl_Persons WITH (NOLOCK))

given that NOLOCK and READUNCOMMITTED are not allowed for UPDATE, INSERT and DELETE statements https://learn.microsoft.com/en-us/sql/t-sql/queries/update-transact-sql. Does temporary variable assignment qualify under this rule as an INSERT?

Joe McCarty
  • 145
  • 1
  • 2
  • 8

0 Answers0