日期:2014-05-18  浏览次数:20440 次

在一个存储过程中怎样调用一个自定义函数返回的表变量
在一个存储过程中怎样调用一个自定义函数返回的表变量给个列子

------解决方案--------------------
参考如下:

CREATE FUNCTION dbo.function1
(
@para int
)
RETURNS @table TABLE ( id nvarchar(512) ) --返回的表
AS
begin
insert into @table
select 1 from dbo.someTable --示例,应按实际情况改写
return
end


--调用示例
select * from dbo.function1(1)
------解决方案--------------------
create function funxx()
returns @a table(da smalldatetime)
as
begin
insert @a select '2007-05-31 '
return
end
go
create proc procxx
as
select * from dbo.funxx()