sqlserver自定义函数返回表类型
Sql代码 www.2cto.com
use WANSYSTEMDB
go
create function query_question_option(
@pid int
)
returns @temptale table
(
pid int ,
optionstr varchar(5000)
)
as
begin
declare @fullText varchar(5000)
set @fullText=''
select @fullText=@fullText+oflag+soption+'>>' from question_option where qid=@pid
insert into @temptale values(@pid,@fullText)
return
end