SELECT INTO FROM 与 INSERT INTO SELECT
来源:互联网 发布:2016 手机淘宝试用中心 编辑:程序博客网 时间:2024/04/28 19:06
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区别
- 与客户的沟通技巧
- 解决“A problem has been encountered while loading the setup components. Canceling setup.”的问题
- 这是一个关于UC浏览器和电脑技术的博客
- Bad version number in .class file
- MFC中自定义消息
- SELECT INTO FROM 与 INSERT INTO SELECT
- Android高手进阶教程(十七)---列出Android设备中所有启动的服务,及判断某个服务是否开启!
- C 语言标准定义的32 个关键字
- 从字符串中找出数字字符串
- Ogre+Opcode实现碰撞检测
- jQuery+json+servlet小例子
- LINUX与UNIX Shell编程-------后台执行命令
- Elemites:挥指间樯橹灰飞烟灭
- 读书笔记(第一讲)