powerdesigner批量處理字段信息

批量修改字段

'*****************************************************************************
 '文件:powerdesigner.ucase.VBs
 '版本:1.0
 '功能:遍歷物理模型中的所有表,將表名、表代碼、字段名、字段代碼全部由小寫改成大寫;
 ' 并將序列的名和代碼由小寫改成大寫。
 '用法:打開物理模型,運行本腳本(Ctrl+Shift+X)
 '備注:
 '*****************************************************************************
 dim model 'current model
 set model = ActiveModel
If (model Is Nothing) Then
 MsgBox "There is no current Model"
 ElseIf Not model.IsKindOf(PdPDM.cls_Model) Then
 MsgBox "The current model is not an Physical Data model."
 Else
 ProcessTables model
 ProcessSequences model
 End If
'*****************************************************************************
 '函數(shù):ProcessSequences
 '功能:遞歸遍歷所有的序列
 '*****************************************************************************
 sub ProcessSequences(folder)
 '處理模型中的序列:小寫改大寫
 dim sequence
 for each sequence in folder.sequences
 sequence.name = UCase(sequence.name)
 sequence.code = UCase(sequence.code)
 next
 end sub
'*****************************************************************************
 '函數(shù):ProcessTables
 '功能:遞歸遍歷所有的表
 '*****************************************************************************
 sub ProcessTables(folder)
 '處理模型中的表
 dim table
 for each table in folder.tables
 if not table.IsShortCut then 
ProcessTable table
 end if
 next
 '對子目錄進行遞歸
 dim subFolder
 for each subFolder in folder.Packages
 ProcessTables subFolder
 next 
end sub
'*****************************************************************************
 '函數(shù):ProcessTable
 '功能:遍歷指定table的所有字段,將字段名由小寫改成大寫,
 ' 字段代碼由小寫改成大寫
 ' 表名由小寫改成大寫 
'*****************************************************************************
 sub ProcessTable(table)
 dim col
 for each col in table.Columns
  if col.Code = "id" then
  col.DataType = "bigInt"
  End if
 next 

 end sub
最后編輯于
?著作權歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容