FIX: You receive an incorrect value when you query the last-inserted identity value after you use a client-side cursor to insert data to a table that contains an identity column in an application that uses ActiveX Data Objects

Article translations Article translations
Article ID: 961451 - View products that this article applies to.
Expand all | Collapse all

On This Page

SYMPTOMS

Consider the following scenario.
  • In an instance of Microsoft SQL Server, you have two tables, and each table contains an identity column.
  • You create an INSERT trigger on the first table. The trigger inserts data to the second table when the trigger executes.
  • You have an application that uses Microsoft ActiveX Data Objects (ADO) to connect to the instance of SQL Server.
  • In the application, you use a client-side cursor to insert data to the first table.
In this scenario, when you run the application and then query the last-inserted identity value, you may find that the function returns an incorrect value. The value corresponds to the auto-increment value that is generated on the second table instead of on the first table.

This problem occurs in the Microsoft Data Access Components (MDAC) 2.8. You may have MDAC 2.8 installed on one of the following Windows operating systems:
  • Windows XP Service Pack 2 (SP2)
  • Windows XP Service Pack 3 (SP3)
  • Windows Server 2003 Service Pack 1 (SP1)
  • Windows Server 2003 Service Pack 2 (SP2)
  • Windows Vista Service Pack 1 (SP1)
  • Windows Server 2008

CAUSE

When data is inserted in the first table, the insert trigger uses the @@IDENTITY function instead of the SCOPE_IDENTITY function to obtain the last-inserted identity value. Therefore, the @@IDENTITY function may return an identity value that is not generated by the same table.

RESOLUTION

Hotfix information

A supported hotfix is available from Microsoft. However, this hotfix is intended to correct only the problem that is described in this article. Apply this hotfix only to systems that are experiencing the problem described in this article. This hotfix might receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next software update that contains this hotfix.

If the hotfix is available for download, there is a "Hotfix download available" section at the top of this Knowledge Base article. If this section does not appear, contact Microsoft Customer Service and Support to obtain the hotfix.

Note If additional issues occur or if any troubleshooting is required, you might have to create a separate service request. The usual support costs will apply to additional support questions and issues that do not qualify for this specific hotfix. For a complete list of Microsoft Customer Service and Support telephone numbers or to create a separate service request, visit the following Microsoft Web site:
http://support.microsoft.com/contactus/?ws=support
Note The "Hotfix download available" form displays the languages for which the hotfix is available. If you do not see your language, it is because a hotfix is not available for that language.

Prerequisites

You must have the corresponding service pack installed before you apply this hotfix.

Restart information

You do not have to restart the computer after you apply this hotfix.

Registry information

You do not have to change the registry.

Hotfix file information

This hotfix contains only those files that are required to correct the issues that this article lists. This hotfix may not contain of all the files that you must have to fully update a product to the latest build. The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time item in Control Panel.
Windows XP SP2, 32-bit version
Collapse this tableExpand this table
File nameFile versionFile sizeDateTime
Msadce.dll2.81.1144.0331,77631-Dec-200814:35
Windows XP SP3, 32-bit version
Collapse this tableExpand this table
File nameFile versionFile sizeDateTime
Msadce.dll2.81.3010.0331,77631-Dec-200814:38
Windows Server 2003 SP1, 32-bit version
Collapse this tableExpand this table
File nameFile versionFile sizeDateTime
Msadce.dll2.82.3272.0356,35231-Dec-200816:04
Windows Server 2003 SP1, x64-based version
Collapse this tableExpand this table
File nameFile versionFile sizeDateTimePlatform
Msadce.dll2.82.3272.0622,59231-Dec-200813:48x64
Wmsadce.dll2.82.3272.0356,35231-Dec-200813:48x86
Windows Server 2003 SP1, Itanium-based version
Collapse this tableExpand this table
File nameFile versionFile sizeDateTimePlatform
Msadce.dll2.82.3272.01,212,41631-Dec-200813:48IA-64
Wmsadce.dll2.82.3272.0356,35231-Dec-200813:48x86
Windows Server 2003 SP2, 32-bit version
Collapse this tableExpand this table
File nameFile versionFile sizeDateTime
Msadce.dll2.82.4437.0356,35231-Dec-200815:55
Windows Server 2003 SP2, x64-based version
Collapse this tableExpand this table
File nameFile versionFile sizeDateTimePlatform
Msadce.dll2.82.4437.0622,59231-Dec-200813:53x64
Wmsadce.dll2.82.4437.0356,35231-Dec-200813:53x86
Windows Server 2003 SP2, Itanium-based version
Collapse this tableExpand this table
File nameFile versionFile sizeDateTimePlatform
Msadce.dll2.82.4437.01,212,41631-Dec-200813:51IA-64
Wmsadce.dll2.82.4437.0356,35231-Dec-200813:51x86
Windows Vista SP1, 32-bit version
Collapse this tableExpand this table
File nameFile versionFile sizeDateTime
Package_for_kb961451_client_1~31bf3856ad364e35~x86~~6.0.2.0.mumNot Applicable1,36731-Dec-200815:00
Package_for_kb961451_client~31bf3856ad364e35~x86~~6.0.2.0.mumNot Applicable1,43031-Dec-200815:00
Package_for_kb961451_sc_0~31bf3856ad364e35~x86~~6.0.2.0.mumNot Applicable1,42131-Dec-200815:00
Package_for_kb961451_sc~31bf3856ad364e35~x86~~6.0.2.0.mumNot Applicable1,42231-Dec-200815:00
Package_for_kb961451_server_0~31bf3856ad364e35~x86~~6.0.2.0.mumNot Applicable1,42531-Dec-200815:00
Package_for_kb961451_server~31bf3856ad364e35~x86~~6.0.2.0.mumNot Applicable1,43031-Dec-200815:00
X86_5e4a93ecd0b53d31b4ac3789c9b5bd45_31bf3856ad364e35_6.0.6001.22342_none_2f74674e1031809b.manifestNot Applicable73831-Dec-200815:00
X86_microsoft-windows-m..nts-mdac-rds-ce-dll_31bf3856ad364e35_6.0.6001.22342_none_6251560e5afb6c40.manifestNot Applicable15,00131-Dec-200804:57
Msadce.dll6.0.6001.22342454,65631-Dec-200804:23
Windows Vista SP1, x64-based version
Collapse this tableExpand this table
File nameFile versionFile sizeDateTimePlatform
Amd64_493387e62613f98c9bf65441084bd917_31bf3856ad364e35_6.0.6001.22342_none_f1cd024aaf4fde26.manifestNot Applicable1,12431-Dec-200815:00Not Applicable
Amd64_microsoft-windows-m..nts-mdac-rds-ce-dll_31bf3856ad364e35_6.0.6001.22342_none_be6ff1921358dd76.manifestNot Applicable14,68331-Dec-200805:26Not Applicable
Package_for_kb961451_client_1~31bf3856ad364e35~amd64~~6.0.2.0.mumNot Applicable1,37531-Dec-200815:00Not Applicable
Package_for_kb961451_client~31bf3856ad364e35~amd64~~6.0.2.0.mumNot Applicable1,43831-Dec-200815:00Not Applicable
Package_for_kb961451_sc_0~31bf3856ad364e35~amd64~~6.0.2.0.mumNot Applicable1,42931-Dec-200815:00Not Applicable
Package_for_kb961451_sc~31bf3856ad364e35~amd64~~6.0.2.0.mumNot Applicable1,43031-Dec-200815:00Not Applicable
Package_for_kb961451_server_0~31bf3856ad364e35~amd64~~6.0.2.0.mumNot Applicable1,43331-Dec-200815:00Not Applicable
Package_for_kb961451_server~31bf3856ad364e35~amd64~~6.0.2.0.mumNot Applicable1,43831-Dec-200815:00Not Applicable
X86_microsoft-windows-m..nts-mdac-rds-ce-dll_31bf3856ad364e35_6.0.6001.22342_none_6251560e5afb6c40.manifestNot Applicable15,00131-Dec-200804:57Not Applicable
Msadce.dll6.0.6001.22342589,82431-Dec-200804:48x64
Msadce.dll6.0.6001.22342454,65631-Dec-200804:23x86
Windows Vista SP1, Itanium-based version
Collapse this tableExpand this table
File nameFile versionFile sizeDateTime
Ia64_81d9a6114da25ea41bd90118475b77eb_31bf3856ad364e35_6.0.6001.22342_none_38746d245142eb79.manifestNot Applicable1,12231-Dec-200815:00
Ia64_microsoft-windows-m..nts-mdac-rds-ce-dll_31bf3856ad364e35_6.0.6001.22342_none_6252fa045af9753c.manifestNot Applicable14,66731-Dec-200805:16
Package_for_kb961451_sc_0~31bf3856ad364e35~ia64~~6.0.2.0.mumNot Applicable1,42531-Dec-200815:00
Package_for_kb961451_sc~31bf3856ad364e35~ia64~~6.0.2.0.mumNot Applicable1,42631-Dec-200815:00
Package_for_kb961451_server_0~31bf3856ad364e35~ia64~~6.0.2.0.mumNot Applicable1,42931-Dec-200815:00
Package_for_kb961451_server~31bf3856ad364e35~ia64~~6.0.2.0.mumNot Applicable1,43431-Dec-200815:00
Msadce.dll6.0.6001.223421,175,55231-Dec-200804:41
Windows Server 2008, 32-bit version
Collapse this tableExpand this table
File nameFile versionFile sizeDateTime
Package_for_kb961451_client_1~31bf3856ad364e35~x86~~6.0.2.0.mumNot Applicable1,36731-Dec-200815:00
Package_for_kb961451_client~31bf3856ad364e35~x86~~6.0.2.0.mumNot Applicable1,43031-Dec-200815:00
Package_for_kb961451_sc_0~31bf3856ad364e35~x86~~6.0.2.0.mumNot Applicable1,42131-Dec-200815:00
Package_for_kb961451_sc~31bf3856ad364e35~x86~~6.0.2.0.mumNot Applicable1,42231-Dec-200815:00
Package_for_kb961451_server_0~31bf3856ad364e35~x86~~6.0.2.0.mumNot Applicable1,42531-Dec-200815:00
Package_for_kb961451_server~31bf3856ad364e35~x86~~6.0.2.0.mumNot Applicable1,43031-Dec-200815:00
X86_5e4a93ecd0b53d31b4ac3789c9b5bd45_31bf3856ad364e35_6.0.6001.22342_none_2f74674e1031809b.manifestNot Applicable73831-Dec-200815:00
X86_microsoft-windows-m..nts-mdac-rds-ce-dll_31bf3856ad364e35_6.0.6001.22342_none_6251560e5afb6c40.manifestNot Applicable15,00131-Dec-200804:57
Msadce.dll6.0.6001.22342454,65631-Dec-200804:23
Windows Server 2008, x64-based version
Collapse this tableExpand this table
File nameFile versionFile sizeDateTimePlatform
Amd64_493387e62613f98c9bf65441084bd917_31bf3856ad364e35_6.0.6001.22342_none_f1cd024aaf4fde26.manifestNot Applicable1,12431-Dec-200815:00Not Applicable
Amd64_microsoft-windows-m..nts-mdac-rds-ce-dll_31bf3856ad364e35_6.0.6001.22342_none_be6ff1921358dd76.manifestNot Applicable14,68331-Dec-200805:26Not Applicable
Package_for_kb961451_client_1~31bf3856ad364e35~amd64~~6.0.2.0.mumNot Applicable1,37531-Dec-200815:00Not Applicable
Package_for_kb961451_client~31bf3856ad364e35~amd64~~6.0.2.0.mumNot Applicable1,43831-Dec-200815:00Not Applicable
Package_for_kb961451_sc_0~31bf3856ad364e35~amd64~~6.0.2.0.mumNot Applicable1,42931-Dec-200815:00Not Applicable
Package_for_kb961451_sc~31bf3856ad364e35~amd64~~6.0.2.0.mumNot Applicable1,43031-Dec-200815:00Not Applicable
Package_for_kb961451_server_0~31bf3856ad364e35~amd64~~6.0.2.0.mumNot Applicable1,43331-Dec-200815:00Not Applicable
Package_for_kb961451_server~31bf3856ad364e35~amd64~~6.0.2.0.mumNot Applicable1,43831-Dec-200815:00Not Applicable
X86_microsoft-windows-m..nts-mdac-rds-ce-dll_31bf3856ad364e35_6.0.6001.22342_none_6251560e5afb6c40.manifestNot Applicable15,00131-Dec-200804:57Not Applicable
Msadce.dll6.0.6001.22342589,82431-Dec-200804:48x64
Msadce.dll6.0.6001.22342454,65631-Dec-200804:23x86
Windows Server 2008, Itanium-based version
Collapse this tableExpand this table
File nameFile versionFile sizeDateTimePlatform
Ia64_81d9a6114da25ea41bd90118475b77eb_31bf3856ad364e35_6.0.6001.22342_none_38746d245142eb79.manifestNot Applicable1,12231-Dec-200815:00Not Applicable
Ia64_microsoft-windows-m..nts-mdac-rds-ce-dll_31bf3856ad364e35_6.0.6001.22342_none_6252fa045af9753c.manifestNot Applicable14,66731-Dec-200805:16Not Applicable
Package_for_kb961451_sc_0~31bf3856ad364e35~ia64~~6.0.2.0.mumNot Applicable1,42531-Dec-200815:00Not Applicable
Package_for_kb961451_sc~31bf3856ad364e35~ia64~~6.0.2.0.mumNot Applicable1,42631-Dec-200815:00Not Applicable
Package_for_kb961451_server_0~31bf3856ad364e35~ia64~~6.0.2.0.mumNot Applicable1,42931-Dec-200815:00Not Applicable
Package_for_kb961451_server~31bf3856ad364e35~ia64~~6.0.2.0.mumNot Applicable1,43431-Dec-200815:00Not Applicable
X86_microsoft-windows-m..nts-mdac-rds-ce-dll_31bf3856ad364e35_6.0.6001.22342_none_6251560e5afb6c40.manifestNot Applicable15,00131-Dec-200804:57Not Applicable
Msadce.dll6.0.6001.223421,175,55231-Dec-200804:41IA-64
Msadce.dll6.0.6001.22342454,65631-Dec-200804:23x86

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

MORE INFORMATION

Note The fix does not change the behavior of ADO through Microsoft OLE DB provider for ODBC (MSDASQL).. For more information about the naming schema for SQL Server updates, click the following article number to view the article in the Microsoft Knowledge Base:
822499 New naming schema for Microsoft SQL Server software update packages
For more information about software update terminology, click the following article number to view the article in the Microsoft Knowledge Base:
824684 Description of the standard terminology that is used to describe Microsoft software updates

Properties

Article ID: 961451 - Last Review: August 25, 2009 - Revision: 2.0
APPLIES TO
  • Microsoft Windows XP Service Pack 2
  • Microsoft Windows XP Service Pack 3
  • Microsoft Windows Server 2003 Service Pack 1
  • Microsoft Windows Server 2003 Service Pack 2
  • Windows Vista Service Pack 1
  • Windows Server 2008 Datacenter
  • Windows Server 2008 Enterprise
  • Windows Server 2008 Standard
Keywords: 
kbautohotfix kbsurveynew kbfix kbqfe kbexpertiseadvanced kbhotfixserver KB961451

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com