批量將PowerDesigner中表字段由小寫變成大寫


通過以下VB腳本即可批量修改,在Tools=>Execute Commands下的Edit/Run Scripts,或者通過Ctrl+Shift+X運行以下腳本即可:

'*****************************************************************************
 '文件: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
'*****************************************************************************
 '函數: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
'*****************************************************************************
 '函數: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
'*****************************************************************************
 '函數:ProcessTable
 '功能:遍歷指定table的所有字段,將字段名由小寫改成大寫,
 ' 字段代碼由小寫改成大寫
 ' 表名由小寫改成大寫 
'*****************************************************************************
 sub ProcessTable(table)
 dim col
 for each col in table.Columns
 '將字段名由小寫改成大寫
 col.code = UCase(col.code)
 col.name = UCase(col.name)
 next 
table.name = UCase(table.name)
 table.code = UCase(table.code)
 end sub

原帖地址:http://blog.csdn.net/xzknet/article/details/43274467


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM