We've recently begun planning our upgrade to SQL 2005 from SQL 2000 (see versions below). During testing we discovered we can nolonger specify conflicting locking hints within an UPDATE statement. For example, our SQL 2000 systems have code similar to this (line numbers added): 1| UPDATE dbo.flSalesDetail WITH (ROWLOCK) 2| SET net_amt = gross_amt + storage_amt - credit 3| FROM dbo.flSalesSummary AS summary WITH (NOLOCK) 4| INNER JOIN dbo.flSalesDetail AS detail WITH (NOLOCK) 5| ON detail.invoice_no = summary.invoice_no 6| WHERE summary.batch_no = @batch_noWhen the code above is executed in SQL 2005 the following error is generated: Msg 1047, Level 15, State 1, Procedure spCreateBatchMillInvoices, Line 152 Conflicting locking hints specified.Changing the locking hint on line 4 from NOLOCK to ROWLOCK, fixes the problem.To me this makes sense, although I haven't found anything in BOL to support this. I'm wondering why the code worked at all under SQL 2000. Is this a new 2005 bug, or is this a 2000 bug that's been corrected in 2005? Is this simply a behavior change? If so, why didn't we see anything about this in the upgrade literature?Current Servers: Microsoft SQL Server 2000 - 8.00.997 (Intel X86)Test 2005 Server: Microsoft SQL Server 2005 - 9.00.1399.06 (Intel X86)
Please wait...