daimaxuejia

1:复制表结构及数据到新表

select * into 目的数据库名.dbo.目的表名 from 原表名

select * into my0735home.dbo.infoMianTest from infoMian

2:备份表的一部分列(不写*而写出列的列表)

select 列名1,列名2,列名3 into 目的数据库名.dbo.目的表名 from 原表名

select id,title,mtype,stype,author,tel,nr into infoMianTest2 from infomian

3:备份表的一部分行(加WHERE条件)

select * into 目的数据库名.dbo.目的表名 from 原表名 where id<10

select * into infomiantest2 from infomian where id<10

4:备份表的一部分列(不写*而写出列的列表)和一部分行(加WHERE条件)

select 列名1,列名2,列名3 into 目的数据库名.dbo.目的表名 from 原表名 where  id<10

5:只复制表的结构:如:SELECT * INOT t1 FROM titles WHERE 1=2

6:查询结果来源于多个表:如:

SELECT title_id,title,pub_name INTO t3

FROM titles t INNER JOIN publishers p

ON t.pub_id=p.pub_id

分类:

技术点:

相关文章:

  • 2021-12-24
  • 2021-09-06
  • 2021-11-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-31
猜你喜欢
  • 2022-12-23
  • 2022-02-22
  • 2021-08-13
  • 2022-12-23
  • 2022-12-23
  • 2022-01-23
  • 2021-11-13
相关资源
相似解决方案