You can also find the following quote in the topic Table Hint (Transact-SQL): "Specifying NOLOCK or READUNCOMMITTED in the FROM clause of an UPDATE or DELETE statement when applied to the target table of the statement." In the SQL Server Books Online topic, Deprecated Database Engine Features in SQL Server 2005, you can find the following deprecation notice: ![]() SELECTs which also used NOLOCK, allowing for dirty reads in either scenario - again, this was true with or without the hint on the UPDATE). And yes, other statements were still blocked while the update was running (unless they were Sys.dm_tran_locks) is identical, with or without the hint. I ran some tests on SQL Server 2008 and confirmed that the locking behavior (at least according to So code that uses this hint is implying some sort of non-blocking behavior that doesn't actually happen (and, frankly, isn't possible, when you think about it). NOLOCK has been ignored in this scenario since SQL Server 2005. I'll briefly explain three reasons these NOLOCK hints shouldn't be in your DML statements: If SQL Server doesn't raise an error message, then this must be okay, right? This depends on your definition of "okay" and, more importantly, how future-proof you want your code to be. ![]() The NOLOCK and READUNCOMMITTED lock hints are not allowed for target tables of INSERT, UPDATE, DELETE or MERGE statements.Īnd in spite of the wording of the message, the same error is not raised in any of the other patterns I demonstrated above.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |