怎樣匯出sybase資料庫的所有庫結構和表結構的建庫

時間 2021-12-23 05:34:01

1樓:

在不同平台上導資料時,只能用bcp命令,但是bcp命令不能匯出資料庫表結構,所以需進行資料庫表結構的匯出。

在sybase12.5版本以上,可以用如下方式匯出表結構:

ddlgen –usa –p*** –ddb_name –s***:port –ooutput_file

其中db_name指所要匯出的資料庫名。

********************************************

低於sybase12.5版本的,得進行執行指令碼的方式匯出表結構。指令碼檔案內容如下:

use sybsystemprocs

goif object_id('dbo.sp_ddl_create_table') is not null

drop procedure sp_ddl_create_table

print "dropping sp_ddl_create_table"

gocreate proc sp_ddl_create_table

as-- creates the ddl for all the user tables in the

-- current database

select right('create table ' + so1.name + '(' + '

', 255 * ( abs( sign(sc1.colid - 1) - 1 ) ) )+

sc1.name + ' ' +

st1.name + ' ' +

substring( '(' + rtrim( convert( char, sc1.length ) ) + ') ', 1,

patindex('%char', st1.name ) * 10 ) +

substring( '(' + rtrim( convert( char, sc1.prec ) ) + ', ' + rtrim(

convert( char, sc1.scale ) ) + ') ' , 1, patindex('numeric', st1.name ) * 10 ) +

substring( 'not null', ( convert( int, convert( bit,( sc1.status & 8 ) ) ) * 4 ) + 1,

8 * abs(convert(bit, (sc1.status & 0x80)) - 1 ) ) +

right('identity ', 9 * convert(bit, (sc1.status & 0x80)) ) +

right(',', 5 * ( convert(int,sc2.colid) - convert(int,sc1.colid) ) ) +

right(' )

' + 'go' + '

' + '

', 255 * abs( sign( ( convert(int,sc2.colid) - convert(int,sc1.colid) ) ) -

1 ) )

from sysobjects so1,

syscolumns sc1,

syscolumns sc2,

systypes st1

where so1.type = 'u'

and sc1.id = so1.id

and st1.usertype = sc1.usertype

and sc2.id = sc1.id

and sc2.colid = (select max(colid)

from syscolumns

where id = sc1.id)

order by so1.name, sc1.colid

goif object_id('dbo.sp_ddl_create_table') is not null

begin

grant execute on sp_ddl_create_table to public

print "created sp_ddl_create_table"

endelse

print "failed to create sp_ddl_create_table"

檢視具體某資料庫表結構方法如下,以檢視nbcredit資料庫表結構為例:

編輯指令碼檔案script.txt,儲存在c:\,內容如下:

use nbcredit

gosp_ddl_create_table

go然後執行以下語名:isql –usa –p*** –b –i script.txt –o scriptout.txt

其中scriptout.txt檔案的內容即為整個資料庫表結構。

2樓:du瓶邪

建表語句可以通過如下匯出,選中資料庫-->右鍵匯出-->資料庫物件--選擇表就可以了:

資料可以寫個bat檔案或者shell檔案,用bcp out匯出即可.

3樓:

sybase central不是可以麼?你連線上資料庫後選開啟你需要的儲存過程或者使用者表右鍵生成ddl即可~還有你要insert into可以先改你的建表語句然後直接在sybase advantage中的相應資料庫中提交即可~~~

4樓:歸浦秋梵

直接用access匯入,就能得到資料結構了

5樓:

dbartisan是一套企業級跨資料庫平台的資料庫管理工具。dbartisan 是針對oracle, sybase, microsoft sql server及ibm db2 universal databases 管理的解決方案。它豐富的特色能幫助資料庫管理者在企業環境中取得資料庫最大的可用性,效率及安全性。

dbartisan 能讓資料庫管理者透過單一的圖形操作平台同時管理數個資料庫,對於有經驗的及新手的資料庫專業人才都能產生戲劇化般的生產力。

從sybase匯出的sql建表語句,請各位看下

6樓:

dml_logging = full 表示使用完全dml日誌模式,

on 'default'表示將表建立在預設資料段上面。

請問如何在sybase下建庫和掛庫 20

7樓:匿名使用者

您好,希望以下回答能幫助您

是sybase ase? 服務是安裝sybase 資料庫系統時自動建立的,資料庫要可以在sybase central中建立。

如您還有疑問可繼續追問。

如何設定sybase資料庫的使用者許可權

sybase資料庫的使用者,包含兩個層面 乙個是登陸號,另乙個是具體db的使用者,我們登陸時,使用的是登入號,但是這個登入號可以操作哪些db及操作許可權則取決於資料庫使用者。一般情況下,我們可以採取相同的名字來表示登入號和資料庫使用者。首先建立乙個登陸號 sp addlogin loginame,p...

sybase 中建立的資料庫 如何更名

sp renamedb dbname old name newname new name 引數 dbname old name 是資料庫的當前名稱。old name 為 sysname 型別,無預設值。newname new name 是資料庫的新名稱。new name 必須遵循識別符號規則。new...

如何修改sybase 資料庫的頁面大小

sybase的page size是在建立服務名時指定的,服務建立後,該服務下面包含的所有資料庫的page size就固定了,沒法修改,只有重建服務重新指定。如果是windows平台,在使用sybase ase 12 5 bin 建立服務時可以指定頁面大小,如果是unix或linux平台,則在rs資源...

Android資料庫檔案的匯出失敗

是不是許可權不夠?這個檔案的許可權是 rw rw 你試試其他的檔案看看 android手機怎樣匯出資料庫檔案 sqlite資料庫建立的是.db檔案,有很多軟體可以開啟這個檔案,比如sqlite expert android建立sqlite 資料庫的時候,總是不能生成db檔案 你的mytest 裡並沒...

oracle資料庫中怎樣刪除表的重複資料

這個問題就是要刪除表中重複的記錄,查詢的sql語句如下 select id,name from select id,name,row numer over partition by id,name order by id,name rn from tablea where rn 1 刪除的sql語句...