create
proc
Aa
@age int
as
if object_id ( ' tempdb.dbo.##test ' ) is null **** 判断临时表是否存在,存在就跳过,不存在就执行下面代码 ****/
begin
create table tempdb.dbo.##test
@age int
as
if object_id ( ' tempdb.dbo.##test ' ) is null **** 判断临时表是否存在,存在就跳过,不存在就执行下面代码 ****/
begin
create table tempdb.dbo.##test
(
age int not null ,
num int not null
)
insert into ##test values ( 1 , 1 )
end
else
begin
update ##test set age = @age
end
go
----------------------------------------
age int not null ,
num int not null
)
insert into ##test values ( 1 , 1 )
end
else
begin
update ##test set age = @age
end
go
----------------------------------------
create
proc
getTest
as
select * from ##test
----------------------------------------
as
select * from ##test
----------------------------------------