Symptoms
If you run a remote stored procedure with output parameters on a linked server through an ODBC driver for SQL Server, the ODBC driver cannot retrieve the output parameter and you may receive the following error message:
[Microsoft][ODBC SQL Server Driver]Restricted data type attribute violation
Resolution
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=supportNote 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. ' The English version of this hotfix has the file attributes (or later) 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 tool in Control Panel.
MDAC 2.7 Service Pack 1
Date Time Version Size File name
----------------------------------------------------------
12-Nov-2002 02:42 2000.81.9031.12 24,576 Odbcbcp.dll
12-Nov-2002 02:41 2000.81.9031.12 385,024 Sqlsrv32.dll
MDAC 2.8
Date Time Version Size File name
---------------------------------------------------------
15-Jun-2004 00:22 2000.85.1045.0 28,672 Dbnmpntw.dll
15-Jun-2004 00:21 2.80.1045.0 147,456 Msadds.dll
15-Jun-2004 00:21 2.80.1045.0 512,000 Msado15.dll
15-Jun-2004 00:21 2.80.1045.0 163,840 Msadomd.dll
15-Jun-2004 00:21 2.80.1045.0 184,320 Msadox.dll
15-Jun-2004 00:21 2.80.1045.0 53,248 Msadrh15.dll
15-Jun-2004 00:21 2.80.1045.0 225,280 Msdaora.dll
15-Jun-2004 00:21 2.80.1045.0 147,456 Msdart.dll
15-Jun-2004 00:21 2.575.1045.0 139,264 Msorcl32.dll
15-Jun-2004 00:21 3.525.1045.0 221,184 Odbc32.dll
15-Jun-2004 00:22 2000.85.1045.0 24,576 Odbcbcp.dll
15-Jun-2004 00:21 2.80.1045.0 442,368 Oledb32.dll
15-Jun-2004 00:21 2000.85.1045.0 503,808 Sqloledb.dll
15-Jun-2004 00:21 2000.85.1045.0 401,408 Sqlsrv32.dll
15-Jun-2004 00:08 2000.85.1045.0 208,896 Sqlxmlx.dll
Note For a list of all the hotfixes available for MDAC 2.8, click the following article number to view the article in the Microsoft Knowledge Base:
839801 FIX: Hotfixes are available for MDAC 2.8
Status
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
More Information
Steps to reproduce the behavior
-
Use the following code to create a SQL Server stored procedure with output parameters on a linked server:
USE pubs GO CREATE PROCEDURE dbo.sample_stored_procedure @op varchar(20) output AS set @op = 'demo string' return 0 GO
Note You do not receive the error message that is listed in the "Symptoms" section if the stored procedure returns a result set.
-
The following Microsoft Visual Basic application sample code accesses the remote stored procedure on a linked server. In the following code sample, srv1 and
srv2 are the two servers that are running SQL Server, and you are creating srv2 as a linked server on srv1.Dim cn As new ADODB.Connection Dim cmd As new ADODB.Command Dim prm As ADODB.Parameter cn.Open "Driver={SQL Server};Server=srv1;UID=sa;PWD=sa_password;" cmd.ActiveConnection = cn cmd.CommandType = adCmdStoredProc cmd.CommandText = "srv2.pubs.dbo.sample_stored_procedure" Set prm = cmd.CreateParameter("op", adVarChar, adParamOutput, 20) cmd.Parameters.Append prm cmd.Execute Debug.Print prm.Value cn.Close Set cn = Nothing