先看代码
Create Procedure up_test1 as
Select '1111' --这里没有问题
go
Create Procedure up_test2 AS
create table #tt (a Varchar(4))
insert into #tt Exec up_test1
go
Create Procedure up_test3 as
Create Table #ttt (b varchar(4))
Insert Into #ttt Exec up_test2
go
exec up_test3 --这个执行就不能通过。
Select '1111' --这里没有问题
go
Create Procedure up_test2 AS
create table #tt (a Varchar(4))
insert into #tt Exec up_test1
go
Create Procedure up_test3 as
Create Table #ttt (b varchar(4))
Insert Into #ttt Exec up_test2
go
exec up_test3 --这个执行就不能通过。
经过向BAIDU GOOGLE 等大仙求救都无任何音讯后自己摸索
简单更改了一下存储过程就能执行通过
--
-- Create Procedure up_test1 as
-- Select '1111' --这里没有问题
--go
Alter Procedure up_test2 AS
create table #tt (a Varchar(4))
Declare @strsql nvarchar(2000)
set @strsql='insert into #tt'
Exec up_test1
go
--Create Procedure up_test3 as
-- Create Table #ttt (b varchar(4))
-- Insert Into #ttt Exec up_test2
--go
exec up_test3 --这个执行就能通过。
-- Create Procedure up_test1 as
-- Select '1111' --这里没有问题
--go
Alter Procedure up_test2 AS
create table #tt (a Varchar(4))
Declare @strsql nvarchar(2000)
set @strsql='insert into #tt'
Exec up_test1
go
--Create Procedure up_test3 as
-- Create Table #ttt (b varchar(4))
-- Insert Into #ttt Exec up_test2
--go
exec up_test3 --这个执行就能通过。
……
有时候稍微转个小弯就能搞定问题