SQL SERVER使用ODBC 驱动建立的链接服务器调用存储过程时参数不能为NULL值

我们知道SQL SERVER建立链接服务器(Linked Server)可以选择的驱动程序非常多,最近发现使用ODBC 的 Microsoft OLE DB 驱动程序建立的链接服务器(Linked Server), 调用存储过程过程时,参数不能为NULL值。

否则就会报下面错误提示:

对应的英文错误提示为:

EXEC ..dbo.Usp_Test NULL,NULL,’ALL’

Msg 7213, Level 16, State 1, Line 1

The attempt by the provider to pass remote stored procedure parameters to remote server ” failed. Verify that the number of parameters, the order, and the values passed are correct.

对应的中文错误提示为:

EXEC ..dbo.Usp_Test NULL,NULL,’ALL’

Msg 7213, Level 16, State 1, Line 1

提供程序将远程存储过程参数传递给远程服务器 ” 的尝试失败。请确保参数的数目、顺序和所传递的值正确。

EXEC ..dbo.Usp_Test ”,”,’ALL’ 或者给参数赋予一个合适的值则不会报任何错误。另外使用Microsoft OLE DB Provider for SQL Server驱动方式建立的链接服务器(Linked Server)调用存储过程时参数就可以为NULL。

以上所述是小编给大家分享的SQL SERVER使用ODBC 驱动建立的链接服务器调用存储过程时参数不能为NULL值的全部内容,希望大家喜欢。


数据运维技术 » SQL SERVER使用ODBC 驱动建立的链接服务器调用存储过程时参数不能为NULL值