FIX: Updates to Distributed Partitioned Views May Return Incorrect @@ROWCOUNT Value (306266)



The information in this article applies to:

  • Microsoft SQL Server 2000 Developer Edition
  • Microsoft SQL Server 2000 Enterprise Edition
  • Microsoft SQL Server 2000 Enterprise Evaluation Edition

This article was previously published under Q306266
BUG #: 355122 (SHILOH_BUGS)

SYMPTOMS

When performing a modification to a remote table by way of a distributed partitioned view, there may be situations where the query syntax needs to return the value of a column from the remote table. After such a query, the value of @@ROWCOUNT, which should reflect the number of rows modified, may incorrectly return a value of zero.

CAUSE

If the remote query contains both a select and a modification query, it does not set the value of @@ROWCOUNT to the value returned by the modification.

RESOLUTION

To resolve this problem, obtain the latest service pack for Microsoft SQL Server 2000. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

290211 INF: How to Obtain the Latest SQL Server 2000 Service Pack

Hotfix

NOTE: The following hotfix was created prior to Microsoft SQL Server 2000 Service Pack 2.

The English version of this fix should have the following file attributes or later:
   Version      File name     Platform
   -----------------------------------
   8.00.0432    s80432i.exe   x86
				
NOTE: Due to file dependencies, the most recent hotfix or feature that contains the above files may also contain additional files.

STATUS

Microsoft has confirmed this to be a problem in SQL Server 2000. This problem was first corrected in Microsoft SQL Server 2000 Service Pack 2.

MORE INFORMATION

Modifications to remote tables by way of a distributed partitioned view require either the Enterprise Edition or Developer Edition of SQL Server.

Transact-SQL has an extension to the UPDATE syntax whereby one can retrieve the value of a column before the update, and then update the column in the same command. This syntax resembles the following:
use pubs
go
declare @p1 varchar(40)
update authors set au_fname = 'Joe', @p1 = au_lname where au_id = '172-32-1176'
select @p1
				
When the distributed query processor finds this type of query, it converts it into two statements, a SELECT and an UPDATE. The presence of the SELECT statement in the distributed query plan prevents the correct retrieval of the @@ROWCOUNT value.

Modification Type:MinorLast Reviewed:9/26/2005
Keywords:kbHotfixServer kbQFE kbbug kbfix KB306266