可以返回紀錄集Create ProceDure SP_TEST As Select * From (Select 1 As ID Union All Select 2 Union All Select 3) A GO EXEC SP_TEST GO Drop Procedure SP_TEST --Result /* ID 1 2 3 */
我这样定义为什么不对呢 create proc xx @x table(score int) output as select @x=score from sc where sno='1'
As
Select * From (Select 1 As ID Union All Select 2 Union All Select 3) A
GO
EXEC SP_TEST
GO
Drop Procedure SP_TEST
--Result
/*
ID
1
2
3
*/
create proc xx @x table(score int) output
as
select @x=score
from sc
where sno='1'
我这样定义为什么不对呢
create proc xx @x table(score int) output
as
select @x=score
from sc
where sno='1'
----------------哪有你這樣的語法?create proc xx
as
select score
from sc
where sno='1'
我就是想把所有返回的结果集放到一个表变量里,
就像一个输出参数那样,可以实现么
----------------
存儲過程和函數還是有區別的。你可以直接使用這個存儲過程返回的紀錄集。或者你使用函數吧。
Returns @x table(score int)
as
Begin
insert @x
select score
from sc
where sno='1'
return
End
GO
to:paoluo(一天到晚游泳的鱼)最近你似乎一直都泡在csdn
--------------
最近沒那麼忙。 :)