insert into select和select into的使用和区别介绍_MsSql

admin 2014年5月2日00:04:29MSSQLSERVER评论1,428 次浏览阅读模式


insert into ... select ...:可将表1中的全部数据或者部分数据复制到表2中。

eg:

复制代码 代码如下:

insert into t2(id,name,pwd)
select id,name,pwd from t1


注:t2必须存在。t1中查询的列名可不与t1列名相同。无 values

select...into:查询t1中的数据,插入到t2中。

eg:

复制代码 代码如下:

select * into t2 from t1


注:t2被创建并填充数据。

相关文章
weinxin
我的微信
微信扫一扫
admin
  • 本文由 发表于 2014年5月2日00:04:29
  • 转载请务必保留本文链接:https://anyun.org/a/jishuguanzhu/database/mssqlserver/2014/0502/336.html

发表评论

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: