函数中不允许远程函数调用

时间:2013-03-02 00:30:04

标签: sql-server sql-server-2000

调用远程函数后标量值函数失败。有没有办法调用远程服务器功能?

这是代码

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

1 个答案:

答案 0 :(得分:1)

您无法在函数中执行存储过程,因为假设这样的过程可能会导致副作用,例如表格更改。

可以考虑将你的函数重铸为存储过程,从而允许内部存储过程调用,但要注意这样做充满了危险,警告和危险,如详细讨论{{ 3}}