【发布时间】:2013-02-16 15:10:09
【问题描述】:
标量值函数在调用远程函数后失败。有没有办法调用远程服务器功能?
这是代码
ALTER FUNCTION [dbo].[fnGetCatalogNumber]
(
-- Add the parameters for the function here
@ProductID int
)
RETURNS varchar(20)
AS
BEGIN
-- Declare the return variable here
DECLARE @CatalogNumber varchar(20), @catalog_data varchar(20)
-- Add the T-SQL statements to compute the return value here
--Exec Dev01.Product_Core.dbo.usp_get_CatalogNumber @ProductId = @ProductID
,@CatalogNumber = @catalog_data output
-- Return the result of the function
RETURN @CatalogNumber
END
【问题讨论】:
-
如果可能的话,我会反其道而行之。将逻辑放入函数中,从存储的proc中调用函数。
-
您实际上可以从函数调用存储过程,从 SQL Server 2005 到 SQL Server 2008 R2,但是以一种非常hacky 且不推荐但有效的方式 XD。只要存储过程返回单个结果集。
标签: sql-server sql-server-2000