SQL複製表及表結構

2021-10-09 03:47:20 字數 734 閱讀 6755

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

select title_id,title,pub_name into t3

from titles t inner join publishers p

on t.pub_id=p.pub_id

SQL複製表及表結構

1 複製表結構及資料到新錶 select into 目的資料庫名.dbo.目的表名 from 原表名 select into my0735home.dbo.infomiantest from infomian 2 備份表的一部分列 不寫 而寫出列的列表 select 列名1,列名2,列名3 into...

oracle 複製表結構及表資料

1 複製表結構以及資料 create table d table name as select from s table name 注意並不會建立索引 2 只複製表結構 create table d table name as select from s table name where 1 2 3...

SQL語句複製表結構

1 我想要建立乙個新錶table1,並且這個表中的結構與ts account這個表中完全一樣,如何編寫sql sql語句 sql server select into ele payee account rr from ele payee account where 1 2 oracle mysql...