yanguhung

1. 表结构相同的表,且在同一数据库(如,table1,table2)

insert into table1 select * from table2  # 完全复制

insert into table1 select distinct * from table2 # 不复制重复纪录

insert into table1 select top 5 * from table2  # 前五条纪录

insert into table1(a,b,c) select a,b,c from table2 # 插入指定字段值


2. 不在同一数据库中(如,db1 table1,db2 table2)

insert into db1.table1 select * from db2.table2  #完全复制

insert into db1.table1 select distinct * from db2.table2 # 不复制重复纪录

insert into db1.table1 select top 5 * from db2.table2  # 前五条纪录
insert into db1.table1(a,b,c) select a,b,c from db2.table2 # 插入指定字段值

 

分类:

技术点:

相关文章:

  • 2021-11-30
  • 2021-11-18
  • 2021-08-18
  • 2021-12-24
  • 2021-06-13
  • 2021-05-14
猜你喜欢
  • 2021-06-09
  • 2021-11-30
  • 2021-09-01
  • 2021-07-01
  • 2021-11-30
  • 2021-06-19
相关资源
相似解决方案