我想创建一个临时表,用sql语句实现,请大家帮忙!!
表结构和默认值如下:#temp22:pid pro dianxin wantong qita
11 广东 0 0 0
27 山东 0 0 0
36 陕西 0 0 0
40 安徽 0 0 0
55 海南 0 0 0
65 广东 0 0 0另外前面的pid和pro来自另外一张表#temp33:pid pro
11 广东
27 山东
36 陕西
40 安徽
55 海南
65 广东
表结构和默认值如下:#temp22:pid pro dianxin wantong qita
11 广东 0 0 0
27 山东 0 0 0
36 陕西 0 0 0
40 安徽 0 0 0
55 海南 0 0 0
65 广东 0 0 0另外前面的pid和pro来自另外一张表#temp33:pid pro
11 广东
27 山东
36 陕西
40 安徽
55 海南
65 广东
(
pid int not null,
pro nvarchar(10) not null,
dianxin int null,
wantong int null,
qita int null
)
goinsert into #temp22
select pid,pro,0,0,0
from #temp33
go
select pid,pro,0,0,0
create table #temp22
(
pid int not null,
pro nvarchar(10) not null,
dianxin int default 0 null,
wantong int default 0 null,
qita int default 0 null
)
goinsert into #temp22
select pid,pro,0,0,0
from #temp33
go