Help and Support
Hotfix Download Available

On a computer that has Microsoft Data Access Components 2.8 installed, an application receives an incorrect value for the identity column from a SQL Server 2005 database

Article ID:940569
Last Review:November 27, 2007
Revision:1.1
On This Page

SYMPTOMS

Consider the following scenario. You create a table that has an identity column in a Microsoft SQL Server 2005 database. You configure a merge replication on the table. An application uses Microsoft ActiveX Data Objects (ADO) to insert a row in the table. Then, the application retrieves the inserted row. However, an incorrect value is returned for the identity column.

This problem occurs when the computer that runs the application has one of the following installed:
Windows Server 2003
Windows XP
Microsoft Data Access Components 2.8 (MDAC 2.8)
This problem does not occur in a Microsoft SQL Server 2000 database.

Back to the top

CAUSE

The replication process creates insert triggers in the table. When data is inserted in the table, the insert triggers use the @@IDENTITY variable instead of the SCOPE_IDENTITY function. Therefore, the @@IDENTITY variable may return an identity value that is not in the current table.

Back to the top

RESOLUTION

Hotfix information

Windows XP

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 this specific problem. 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 (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
To apply this hotfix, you must have Windows XP Service Pack 2 installed on the computer. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
322389 (http://support.microsoft.com/kb/322389/) How to obtain the latest Windows XP service pack
Restart requirement
You must restart the computer after you apply this hotfix.
Hotfix replacement information
This hotfix does not replace any other hotfixes.
File information
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.
File nameFile versionFile sizeDateTimePlatform
Msadce.dll2.81.1131.0331,77623-Aug-200710:09x86

Windows Server 2003

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 this specific problem. 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 (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
To apply this hotfix, you must have Windows Server 2003 Service Pack 1 or Windows Server 2003 Service Pack 2 installed on the computer. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
889100 (http://support.microsoft.com/kb/889100/) How to obtain the latest service pack for Windows Server 2003
Restart requirement
You must restart the computer after you apply this hotfix.
Hotfix replacement information
This hotfix does not replace any other hotfixes.
File information
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 Server 2003 with Service Pack 1, x86-based versions
File nameFile versionFile sizeDateTimePlatform
Msadce.dll2.82.2996.0356,35223-Aug-200702:19x86
Windows Server 2003 with Service Pack 2, x86-based versions
File nameFile versionFile sizeDateTimePlatform
Msadce.dll2.82.4137.0356,35223-Aug-200702:10x86
Windows Server 2003 with Service Pack 1, Itanium-based versions
File nameFile versionFile sizeDateTimePlatformSP requirementService branch
Msadce.dll2.82.2996.01,212,41622-Aug-200713:30IA-64SP1Not Applicable
Wmsadce.dll2.82.2996.0356,35222-Aug-200713:30x86SP1WOW
Windows Server 2003 with Service Pack 2, Itanium-based versions
File nameFile versionFile sizeDateTimePlatformSP requirementService branch
Msadce.dll2.82.4137.01,212,41622-Aug-200713:37IA-64SP2Not Applicable
Wmsadce.dll2.82.4137.0356,35222-Aug-200713:37x86SP2WOW
Windows Server 2003, x64-based versions
File nameFile versionFile sizeDateTimePlatformSP requirementService branch
Msadce.dll2.82.2996.0622,59222-Aug-200713:30x64SP1Not Applicable
Wmsadce.dll2.82.2996.0356,35222-Aug-200713:30x86SP1WOW
Windows Server 2003 with Service Pack 2, x64-based versions
File nameFile versionFile sizeDateTimePlatformSP requirementService branch
Msadce.dll2.82.4137.0622,59222-Aug-200713:37x64SP2Not Applicable
Wmsadce.dll2.82.4137.0356,35222-Aug-200713:37x86SP2WOW

Microsoft Data Access Components 2.8

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 this specific problem. 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 (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
To apply this hotfix, you must have MDAC 2.8 Service Pack 1 installed on the computer.
Restart requirement
You must restart the computer after you apply this hotfix.
Hotfix replacement information
This hotfix does not replace any other hotfixes.
File information
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.
File nameFile versionFile sizeDateTimePlatform
Msadce.dll2.81.1131.0319,48817-Aug-200709:58x86
Msadco.dll2.81.1131.0143,36017-Aug-200709:58x86
Msado15.dll2.81.1131.0524,28817-Aug-200709:58x86
Msadomd.dll2.81.1131.0180,22417-Aug-200709:58x86
Msadox.dll2.81.1131.0200,70417-Aug-200709:58x86
Msdasql.dll2.81.1131.0307,20017-Aug-200709:58x86
Msjro.dll2.81.1131.0102,40017-Aug-200709:58x86
Odbcbcp.dll2000.85.1131.024,57617-Aug-200709:58x86
Oledb32.dll2.81.1131.0471,04017-Aug-200709:58x86
Sqloledb.dll2000.85.1131.0520,19217-Aug-200709:58x86
Sqlsrv32.dll2000.85.1131.0438,27217-Aug-200709:58x86

Back to the top

STATUS

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

Back to the top

MORE INFORMATION

The SCOPE_IDENTITY function and the @@IDENTITY variable return the last identity values that are generated in any table in the current session. However, the SCOPE_IDENTITY function returns values that are inserted only within the current scope. The @@IDENTITY variable does not limit the insertion to a specific scope.

For example, assume that the database contains a Table1 and a Table2. Both tables have identity columns. An insert trigger is defined in Table1. When a row is inserted in Table1, the trigger inserts a copy of the row in Table2. This scenario involves the following two scopes:
Insertion in Table1
Insertion in Table2 by the trigger
In this scenario, the @@IDENTITY variable and the SCOPE_IDENTITY function return different values when a row is inserted in Table1. The @@IDENTITY variable returns the last identity column value that is inserted across any scopes in the current session. In this case, the @@IDENTITY variable returns the identity value that is inserted in Table2. However, the SCOPE_IDENTITY function returns the identity value that is inserted in Table1, because the SCOPE_IDENTITY function returns the value that is last inserted in the same scope. The SCOPE_IDENTITY function returns the NULL value if the function is invoked before any INSERT statements that are made to an identity column occur in the scope.

For more information about software update terminology, click the following article number to view the article in the Microsoft Knowledge Base:
824684 (http://support.microsoft.com/kb/824684/LN/) Description of the standard terminology that is used to describe Microsoft software updates

Back to the top


APPLIES TO
Microsoft Windows Server 2003, Standard Edition (32-bit x86)
Microsoft Windows Server 2003, Enterprise Edition (32-bit x86)
Microsoft Windows Server 2003, Web Edition
Microsoft Windows Server 2003, Datacenter Edition (32-bit x86)
Microsoft Windows Server 2003, Standard x64 Edition
Microsoft Windows Server 2003, Enterprise x64 Edition
Microsoft Windows Server 2003, Datacenter x64 Edition
Microsoft Windows Server 2003, Enterprise Edition for Itanium-based Systems
Microsoft Windows Server 2003, Datacenter Edition for Itanium-Based Systems
Microsoft Windows XP Professional
Microsoft Windows XP Home Edition
Microsoft Windows XP Professional x64 Edition
Microsoft Data Access Components 2.8

Back to the top

Keywords: 
kbautohotfix kbwinxppresp3fix kbexpertiseinter kbwinserv2003postsp2fix kbbug kbfix kbhotfixserver kbqfe KB940569

Back to the top

Article Translations

 

Other Support Options

  • Need More Help?
    Contact a Support professional by Email, Online or Phone.
  • Customer Service
    For non-technical assistance with product purchases, subscriptions, online services, events, training courses, corporate sales, piracy issues, and more.
  • Newsgroups
    Pose a question to other users. Discussion groups and Forums about specific Microsoft products, technologies, and services.