Sybase資料庫表備份

2021-07-22 03:12:05 字數 2279 閱讀 1842

1.

insert into select語句

語句形式為:

insert into table2(field1,field2,...) select value1,value2,... from table1

要求目標表table2必須存在,由於目標表

table2

已經存在,所以我們除了插入源表

table1

的字段外,還可以插入常量。示例如下:

--1.建立測試表

create

table table1

(a varchar(10),

b varchar(10),

c varchar(10),

constraint

[pk_table1]

primary

keyclustered

(a asc

)) on

[primary]

create

table table2

(a varchar(10),

c varchar(10),

d int,

constraint

[pk_table2]

primary

keyclustered

(a asc

)) on

[primary]

go--2.建立測試資料

insert

into table1 values('趙','asds','90')

insert

into table1 values('錢','asds','100')

insert

into table1 values('孫','asds','80')

insert

into table1 values('李','asds',null)

goselect

*from table2

--3.insert into select語句複製表資料

insert

into table2(a, c, d) select a,c,5from table1

go--4.顯示更新後的結果

select

*from table2

go--5.刪除測試表

drop

table table1

drop

table table2

2.select into from語句

語句形式為:

select vale1, value2 into table2 from table1

要求目標表table2不存在,因為在插入時會自動建立表

table2

,並將table1

中指定字段資料複製到

table2

中。示例如下:

--1.建立測試表

create

table table1

(a varchar(10),

b varchar(10),

c varchar(10),

constraint

[pk_table1]

primary

keyclustered

(a asc

)) on

[primary]

go--2.建立測試資料

insert

into table1 values('趙','asds','90')

insert

into table1 values('錢','asds','100')

insert

into table1 values('孫','asds','80')

insert

into table1 values('李','asds',null)

go--3.select into from語句建立表table2並複製資料

select a,c into table2 from table1

go--4.顯示更新後的結果

select

*from table2

go--5.刪除測試表

drop

table table1

drop

table table2

Sybase 資料庫bcp out備份重要表資料

bcp相當於邏輯備份,bcp out匯出的檔案,bcp in可以導回去。環境 rhel 5.5 sybase客戶端軟體 需求 在客戶端 linux 備份服務端 hp ux 重要配置表資料 1.bcp out備份指令碼 bin bash sybase bcp out foldername date y...

Sybase資料庫備份方案

作為sybase的伺服器一端,資料風險比較集中,如何做好資料庫的資料備份,成為至關重要的問題。在實際應用中,我們總結出了兩種全量備份方案 一 使用sybase的backup server 備份伺服器 做dump備份 轉儲資料庫 dump database 就是為整個資料庫 包括資料 表結構 觸發器 ...

Sybase資料庫備份方案

sybase資料庫產品自從1987年問世以來,它的客戶機 伺服器 client server 工作模式 分布處理的基礎體系結構 完善的安全保密性能 高速快捷的執行方式 多平台跨作業系統的廣泛應用等優點,迅速被it界接受並推廣應用。我們作為金融業的使用者,也在1995年開始使用sybase10版本。在...