Create PROCEDURE a
....
insert #temp
exec b
...Create PROCEDURE b
..
@sql = ...
insert #temp
exec @sql
..
执行 a 提示:INSERT EXEC 语句不能嵌套。
该如何解决呢?
....
insert #temp
exec b
...Create PROCEDURE b
..
@sql = ...
insert #temp
exec @sql
..
执行 a 提示:INSERT EXEC 语句不能嵌套。
该如何解决呢?
as
select * from sysobjectsgoselect top 0 * into test from sysobjectsinsert into test exec ('p')
select * from test
drop table test
drop proc p
可以写成这样啊Create PROCEDURE b
..
@sql ="insert #temp"
@sql =@sql=....
...exec @sql
..
gocreate proc a
as
exec ('b')gocreate proc b
as
insert into test
exec ('select * from sysobjects')
goexec adrop table test
drop proc a
drop proc b
我这个只是简写.
a 是汇总
b 是明细
是针对不同的报表结果.