当前位置: 代码迷 >> Sql Server >> 函数返回table?解决方法
  详细解决方案

函数返回table?解决方法

热度:28   发布时间:2016-04-27 16:32:05.0
函数返回table?
--函数的建立是正确的
if(object_id( 'test ')is   not   null)
drop   function   test
go
create   function   test()
returns   @t   table(A1   varchar(20),A2   varchar(20),A3   varchar(1000))
as
begin
insert   into   @t
select   A1,A2,A3   from   A  
return
end
go

--这句调用不对,报错
select   dbo.test()   --from   A   where   A1= 'c '
请问如何调用返回table的函数呢?

------解决方案--------------------
select * from dbo.test()
------解决方案--------------------
select * from dbo.test()
  相关解决方案