--把一张表的内容更新到另一张表
update 表1
set 表1.Store=t2.Name
from 表2 t2 where 表1.id=t2.id


--备份一张表
create table tab_new like tab_old (使用旧表创建新表)
create table tab_new as select col1,col2… from tab_old definition only
--(试了以上两句无效)
select * into newtable from oldtable; 如果不想导记录,只想生成表结构 :select * into newtable from oldtable where 1=2;
如果newtable已存在,想导入记录:insert into newtable select * from oldtable where ...


--sqlserver复制表数据到另一个表
SQL Server中如果目标表存在:
insert into 目标表 select * from 原表;
SQL Server中,如果目标表不存在:
select * into 目标表 from 原表;

 

相关文章:

  • 2021-05-19
  • 2021-06-30
  • 2022-12-23
  • 2021-11-27
  • 2022-12-23
  • 2021-04-08
  • 2021-09-30
  • 2021-10-05
猜你喜欢
  • 2021-12-27
  • 2021-12-18
  • 2022-12-23
  • 2022-12-23
  • 2021-10-30
  • 2022-12-23
  • 2021-12-27
相关资源
相似解决方案