Microsoft KB Archive/198674

= FIX: SERIALIZABLE Isolation Fails When Using Aggregate Functions =

Article ID: 198674

Article Last Modified on 10/16/2002

-

APPLIES TO


 * Microsoft SQL Server 7.0 Standard Edition

-



This article was previously published under Q198674



BUG #: 53786 (SQLBUG_70)



SYMPTOMS
SQL Server 7.0 Books Online documents 'SET TRANSACTION ISOLATION LEVEL SERIALIZABLE' as providing the ability prevent other users from performing data modifications when in a transaction.

A SELECT statement using an aggregate function (such as MIN, MAX, COUNT, AVG, and so on) will not maintain the correct range lock and allows modifications on secondary connections. Setting the transaction isolation level to serializable should maintain the range lock and prevent phantom INSERT, UPDATE, and DELETE operations.



RESOLUTION
A supported fix that corrects this problem is now available from Microsoft, but has not been fully regression tested and should be applied only to systems experiencing this specific problem. If you are not severely affected by this specific problem, Microsoft recommends that you wait for the next SQL Server service pack that contains this fix.

To resolve this problem immediately, contact Microsoft Product Support Services to obtain the fix. For a complete list of Microsoft Product Support Services phone numbers and information on support costs, please go to the following address on the World Wide Web:

http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS

The English version of this fix should have the following file attributes or later:

  File name   Platform -

S70631i.exe (x86) S70631a.exe (Alpha)



WORKAROUND
Before executing the aggregate select, perform a "SELECT *" statement from the table with the same conditions to force the appropriate locks to be held.



STATUS
Microsoft has confirmed this to be a problem in SQL Server 7.0.



MORE INFORMATION
For clarity, the following is a sample that demonstrates the behavior.

-- Connection #1 use pubs go set transaction isolation level serializable go begin transaction go

-- -- Should BLOCK the second connection but does not select min(au_lname) from authors go

-- Connection #2 use pubs go set transaction isolation level serializable go begin transaction go insert into authors (au_id, au_lname, au_fname, contract) values ('000-00-0000', 'aa', 'aa', 1) go NOTE: The INSERT should be blocked, but it is allowed to complete. This allows a new row to be introduced in the range that did not exist during the original SELECT operation.

Additional query words: BOL SQLBOL

Keywords: kbbug kbfix kbqfe KB198674

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.