永发信息网

在SQL Server中如何用SQL语句建立一张临时表

答案:3  悬赏:20  手机版
解决时间 2021-01-21 05:47
  • 提问者网友:泪痣哥哥
  • 2021-01-20 16:29
在SQL Server中如何用SQL语句建立一张临时表
最佳答案
  • 五星知识达人网友:不甚了了
  • 2021-01-20 16:54
把【表1】的数据重新插入一张新表【表2】select 列1,列2,..,.. (列自己定义)
into 表2(可以作为临时表)
from 表1(这个表存在的)
全部回答
  • 1楼网友:舍身薄凉客
  • 2021-01-20 18:50
create table #临时表名(剩下的和建立普通表是一样的)
select 字段s.. into #临时表名 from ...
  • 2楼网友:话散在刀尖上
  • 2021-01-20 17:26
create table #t(
id int,
type varchar(20),
name varchar(20),
num int)
go
insert into #t
select '1','a','a1','0' union all
select '2','a','a2','1' union all
select '3','a','a3','2' union all
select '4','b','b1','0' union all
select '5','b','b2','1' union all
select '6','c','c1','0' union all
select '7','c','c2','1' union all
select '8','c','c3','2' union all
select '9','c','c4','3' union all
select '10','c','c5','4' select * from #t
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯