SELECT INTO FROM与INSERT INTO SELECT
来源:互联网 发布:七天网络查分注册 编辑:程序博客网 时间:2024/04/29 01:39
1.INSERT INTO SELECT语句
INSERT INTO SELECT语句复制表数据
--1.创建测试表
create TABLE Table1
(
a varchar(10),
b varchar(10),
c varchar(10),
CONSTRAINT [PK_Table1] PRIMARY KEY CLUSTERED
(
a ASC
)
) ON [PRIMARY]
create TABLE Table2
(
a varchar(10),
c varchar(10),
d int,
CONSTRAINT [PK_Table2] PRIMARY KEY CLUSTERED
(
a ASC
)
) ON [PRIMARY]
GO
--2.创建测试数据
Insert into Table1 values('赵','asds','90')
Insert into Table1 values('钱','asds','100')
Insert into Table1 values('孙','asds','80')
Insert into Table1 values('李','asds',null)
GO
select * from Table2
--3.INSERT INTO SELECT语句复制表数据
Insert into Table2(a, c, d) select a,c, 5 from Table1
GO
--4.显示更新后的结果
select * from Table2
GO
--5.删除测试表
drop TABLE Table1
drop TABLE Table2
SELECT INTO FROM创建表并复制表数据
--1.创建测试表
create TABLE Table1
(
a varchar(10),
b varchar(10),
c varchar(10),
CONSTRAINT [PK_Table1] PRIMARY KEY CLUSTERED
(
a ASC
)
) ON [PRIMARY]
GO
--2.创建测试数据
Insert into Table1 values('赵','asds','90')
Insert into Table1 values('钱','asds','100')
Insert into Table1 values('孙','asds','80')
Insert into Table1 values('李','asds',null)
GO
--3.SELECT INTO FROM语句创建表Table2并复制数据
select a,c INTO Table2 from Table1
GO
--4.显示更新后的结果
select * from Table2
GO
--5.删除测试表
drop TABLE Table1
drop TABLE Table2
- SELECT INTO FROM 与 INSERT INTO SELECT
- SELECT INTO FROM与INSERT INTO SELECT
- SELECT INTO FROM与INSERT INTO SELECT
- SELECT INTO FROM与INSERT INTO SELECT
- SELECT INTO FROM与INSERT INTO SELECT
- SELECT INTO FROM与INSERT INTO SELECT
- SELECT INTO FROM与INSERT INTO SELECT
- insert into from与select into from
- insert into from与select into from
- insert into select from 与 select into from
- insert into select from
- insert into select from
- select into from 与 insert into select 使用方法
- select into from 与 insert into select 区别
- select into from与insert into select区别
- select into from与insert into select区别详解
- insert into...select 与 select...into...from(测试不通过!!!)
- select into from与insert into select区别
- 集合初始化器
- 《寻路中国》读后感
- MFC的消息分类总结(来自深入浅出MFC--侯杰)
- Error: The INF file contains Unicode characters that could not be converted correctly to ANSI 解决办法
- VMware在使用桥接方式时无法联网
- SELECT INTO FROM与INSERT INTO SELECT
- maven 仓库地址
- javascript编辑工具调试工具校验工具格式化标准化工具知识汇总
- 连接查询,三表查询,let子句
- 复杂系统的解与儒道佛
- B 最大覆盖
- assert , ASSERT中的void
- 扩展方法
- php几个常用的数学函数