如何从sql中的函数调用函数

时间:2016-06-17 14:03:01

标签: sql

create FUNCTION [dbo].[fun1] 
(   
    @ID int
)
RETURNS TABLE 
AS
RETURN 
(
    declare @var int
select @var =select columnName from dbo.fun2(@id)
    SELECT @var* columnName  from
    table
    where table.id=@ID

)

我该怎么做?

1 个答案:

答案 0 :(得分:0)

SET @var = ( SELECT columnName 
             from dbo.fun2(@ID)
            );

SELECT @var * columnName  
from table
where table.id = @ID;