PowerDesigner给所有的表字段花城下划线命名规则
Option Explicit
ValidationMode = True
InteractiveMode = im_Batch
Dim mdl ' the current model
Dim opt ' model options
' 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
Set opt = mdl.GetModelOptions()
opt.EnableNameCodeTranslation = true
opt.save
opt.UpdateModelOptions ' need to call this you have made changes
ProcessFolder
End If
' This routine transform code into name for each table, each column of the current folder
Private sub ProcessFolder
Dim obj, tbl, col, str, cha, i
for each tbl in mdl.Tables
Dim codeToName, cTN
for each codeToName in opt.CodeNamingConventions
if (codeToName.Name = tbl.ObjectType) then
'output "Converting " + codeToName.Name + " " + tbl.Code + " code to name using " + codeToName.Script'
tbl.Name = Replace(tbl.Name,"TEM","eim",1,1)
tbl.code= Replace(tbl.code,"TEM","eim",1,1)
for each col in tbl.Columns
for each cTN in opt.CodeNamingConventions
if (cTN.Name = col.ObjectType) then
for i = 1 to len(col.code)
cha = mid(col.code, i, 1)
if(cha = LCase(cha)) then
str = str+cha
else
if(IsEmpty(str) or str="") then
str = str+LCase(cha)
else
str = str+"_"+LCase(cha)
end if
end if
next
end if
next
col.code= str
str = ""
next
end if
next
next
end sub
粘贴到这里运行就可以了