我有一个sp有多个结果集,如
Create procedure spNAME
As
Begin
select * from t1
select * from t2
select * from t3
END
现在我想创建一个存储过程来查找sp
中3语句的结果答案 0 :(得分:1)
重新编写你的proc这样的东西..
Create procedure spNAME
@RS INT = NULL
As
Begin
IF (@RS = 1)
BEGIN
select * from t1
END
IF (@RS = 2)
BEGIN
select * from t2
END
IF (@RS = 3)
BEGIN
select * from t3
END
END
现在将不同的参数值传递给proc,具体取决于您要返回的结果集
Exec spNAME --<-- No Result set
Exec spNAME 1 --<-- Result set 1
Exec spNAME 2 --<-- Result set 2
Exec spNAME 3 --<-- Result set 3