MS SQL中複製一張表到另外乙個資料庫中一張表

2022-02-22 05:33:29 字數 302 閱讀 4989

--複製結構+資料
select *  into 資料庫名.dbo.新錶名   from  資料庫名.dbo.原表名
select

*into stockholder.dbo.shinfo from dspring.dbo.hiremen

--只複製結構
select *  into 資料庫名.dbo.新錶名   from  資料庫名.dbo.原表名 where 1=0

後面的條件只要不成立就ok了  

清空表中的資料:

從一張表中複製資料到另一張表中

分為兩種情況,一種是目標表不存在,另一種是目標表已存在,語法是不同的。分別以sqlserver和oracle為例,兩者略有不同。sqlserver中,如果目標表不存在 select into新錶名from舊表名 sqlserver中,如果目標表已存在 insertinto新錶名select from...

將一張表的資料插入另外一張表

表cmb send sms create table cmb send sms send id bigint 20 not null auto increment comment 主鍵id phone no varchar 32 not null comment 手機號碼 status varcha...

mysql把一張表的資料批量複製到另外一張表

1.表結構完全一樣 insert into 表1 select from 表2 2.表結構不一樣 需要指定列名,並且要一一對應 insert into 表1 列名1,列名2,列名3 select 列1,列2,列3 from 表2 1.表結構完全一樣 insert into 表1 select fro...