PowerDesigner batch modification column case

Faced with different database capitalization specifications, it is too troublesome to modify each field. If you use PowerDesigner design, there is a relatively simple method. Enter PowerDesigner, open a PDM, find in the menu bar: Tools-Excute Commands-Edit/RunScript, or directly press Ctrl+Shift+X to call up the script execution window, and just enter the code below. Using VBScript, the semantics are relatively easy to understand and can be modified according to your needs.

Open the model Tools–>Execute Commands–> Edit/Run Script

UCase UppercaseLCaseLowercase span>

'**************************************** *************************************'File: powerdesigner.ucase.VBs'Version: 1.0' Function: Traverse all tables in the physical model, change the table name, table code, field name, and field code from lowercase to uppercase; 'and change the sequence name and code from lowercase to uppercase. 'Usage: Open the physical model and run this script (Ctrl+Shift+X)'Remarks:'***************************** ************************************************ dim model 'current model set model = ActiveModelIf (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'*********************************************** ******************************'Function: ProcessSequences' Function: Recursively traverse all sequences'******* ************************************************** ******************** sub ProcessSequences(folder)'Process the sequence in the model: dim sequence for each sequence in folder.sequences sequence.name = UCase( sequence.name) sequence.code = UCase(sequence.code) next end sub'******************************** *********************************************'Function: ProcessTables' Function: Recursively traverse all tables'****************************************** *********************************** sub ProcessTables(folder)'dim table for ea ch 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'************ ************************************************** ***************'Function: ProcessTable' Function: Traverse all the fields of the specified table, change the field name from lowercase to uppercase, and change the field code from lowercase to uppercase. The table name is changed from lowercase to uppercase. Change lowercase to uppercase'********************************************* ******************************** sub ProcessTable(table) dim col for each col in table.Columns'Change the field name Change from lowercase to uppercase col.code = UCase(col.code) col.name = UCase(col.name) next table.name = UCase(table.name) table.code = UCase(table.code) end sub  

The original post address: http://blog.csdn.net/xzknet/article/details/43274467

Leave a Comment

Your email address will not be published.