回答

1

你是不是在特定你的问题,有不同的方式表值函数可以(根据需要)被称为:

create procedure Test 
(
    @someParam varchar(50), 
    @someParam2 varchar(50) 
) 
as 
begin 
    set nocount on 

    ... 

    select tf.Col1, tf.Col2, tf.Col3, tf.Col4, tf.Col5 
    from tableValuedFunction0() tf 

    select tf.Col1, tf.Col2 
    from tableValuedFunction1(@someParam) tf 

    create table #temp (...) 

    insert into #temp (...) 
    select tf.Col1, tf.Col2, tf.Col3 
    from tableValuedFunction2(@someParam, @someParam2) tf 

    create table #temp2 (...) 

    insert into #temp2 (...) 
    select t.SomeCol, tf.Col1, tf.Col2 
    from someTable t 
     cross apply tableValuedFunction3(@someParam2, t.SomeOtherCol) tf 

    update t 
    set t.SomeCol = tf.Value 
    from someOtherTable t 
     join tableValuedFunction4(@someParam2) tf on tf.SomeOtherCol = t.SomeOtherCol 

end