powerdesigner匯出字段資訊的vba指令碼

2021-07-08 17:34:55 字數 2078 閱讀 6611

匯出欄位等資訊(在pd中執行如下指令碼,部分地方需要修改)

option explicit

validationmode = true

interactivemode = im_batch

'on error resume next

dim mdl ' the current model

' get the current active model

set mdl = activemodel

if (mdl is nothing) then

msgbox "there is no current model"

elseif not mdl.iskindof(pdpdm.cls_model) then

msgbox "the current model is not an physical data model."

else

processfolder mdl

end if

' this routine copy name into code for each table, each column and each view

' of the current folder

private sub processfolder(folder)

dim tab 'running  table  

dim col 'running column

dim v_datatype,v_length,v_precision,v_primarykey,v_null,v_flag

dim text

dim system, file

set system = createobject("scripting.filesystemobject")

' open mode constants...

forreading   = 1 ' open a file for reading only. you can't write to this file.

forwriting   = 2 ' open a file for writing.

for each tab in folder.tables

if not tab.isshortcut then

if instr(tab.code,"cust")>0 then

for each col in tab.columns

if col.primary=true then '主鍵判斷

v_primarykey = 1

v_null= 0

else

v_primarykey = 0

v_null= 1

end if

v_datatype = ucase(col.datatype)

v_length = col.length  '取資料型別長度

v_precision= col.precision  '取資料型別精度

if  instr(v_datatype,"varchar")>0 then   '資料型別判別

v_datatype = 12

elseif instr(v_datatype,"decimal")>0 then

v_datatype = 3

elseif  instr(v_datatype,"integer")>0 then

v_datatype = 4

end if

'if v_datatype = 4 then

'     v_length =16

'     v_precision = 3

'end if

text = tab.code&":"&col.code&":"&v_datatype&":"&v_length&":"&v_precision&":"&v_primarykey&":"&v_null&":"&col.code&":"&v_flag&vbcrlf

file.write text

next

end if

end if

next

file.close

output "處理結束!"

end sub

PowerDesigner匯出word表結構

選擇資料庫型別,本文選擇oralce,點選確認,2.2 選擇相關的sql指令碼,最後點選確定,生成pdm檢視。3.1 點選report reports templates 進入report模版頁面 3.3 點選report generate reports 進入匯出頁面 3.4 進行相關配置後,在f...

powerdesigner匯出指令碼細節問題

love聊網路那點事 步驟 database generatedatabase 匯出的指令碼需要調整的地方有 mysql5.5測試結果 1 帶有autocreament的字段,主鍵約束要放在建表語句中,不能在外面通過alter加入。因為該欄位必須是主鍵。例如 create table t sys g...

PowerDesigner匯出表到word

一 模版修改 在匯出表時,powerdesigner預設為我們提供了很多的模版,在工具欄中選擇 report report template 即可看到所有的預設模版。如圖一 圖一 模版列表 這裡我們為了匯出powerdesigner中建立的表,在工具欄中選擇 report reports 快捷鍵ct...