
再説一次,新添加的列对于添加它的过程并非立即可见!然而以上的代码却带来了一个性能问题,因爲任何创建临时表并近一步处理它的存储过程都将导致该过程的执行计划重新编译,这对于高吞吐量环境中的大型过程而言,性能会大打折扣!以下过程将解决这个问题:
create proc test4
as
insert #temp default values
select c1 from #temp
go
create proc test3
as
create table #temp (k1 int identity,c1 varchar(2))
exec dbo.test4
go
create proc test2
as
create table #temp (k1 int identity,c1 int)
exec dbo.test4
go
create proc test @var int
as