2

是否可以查询存储过程的结果集?

我只有对存储过程的执行权限,当我运行存储过程时,它会显示数百万行。我需要查询存储过程的结果集。

什么是有效/最简单的方法?

仅供参考,我使用 SQL Server 2012。

4

1 回答 1

2

如果您知道结果是什么样的,那么您可以将它们放入一个表格中。首先创建表,然后使用exec()or exec sp_executesql

例如:

declare @lines table (id int identity(1, 1) primary key, line varchar(8000));

insert into @lines(line)
    exec sp_executesql N'sp_helptext ''information_schema.tables''';

select *
from @lines
order by id; 
于 2013-05-23T16:18:29.433 回答