PowerDesigner 表名、字段大小写转换
面對(duì)不同的數(shù)據(jù)庫(kù)大小寫(xiě)規(guī)范,一個(gè)個(gè)字段修改太麻煩了,如果使用了PowerDesigner設(shè)計(jì),有比較簡(jiǎn)單的方法。進(jìn)入PowerDesigner,打開(kāi)一個(gè)PDM,在菜單欄找到:Tools – Excute Commands – Edit/Run Script,或者直接按Ctrl+Shift+X調(diào)出腳本執(zhí)行窗口,輸入下邊的代碼就可以了。使用的是VBScript,語(yǔ)義比較容易理解,可以根據(jù)自己的需求修改。
打開(kāi)模型 Tools-->Execute Commands --> Edit/Run Script
UCase大寫(xiě) LCase小寫(xiě)
輸入以下語(yǔ)句(根據(jù)實(shí)際情況可做相應(yīng)調(diào)整)
Option Explicit
ValidationMode = True
InteractiveMode = im_Batch
Dim mdl ' the current model
' 取得當(dāng)前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
Private sub ProcessFolder(folder)
??? '處理表
?? Dim Tab
?? for each Tab in folder.tables
???????? tab.code = UCase(tab.code)
???????? '修改字段名
???????? Dim col
???????? for each col in tab.columns
??????????? col.code= UCase(col.code)
???????? next
???????? '修改索引名
???????? Dim idx
???????? for each idx in tab.indexes
??????????? idx.code= UCase(idx.code)
???????? next
???????? '修改主鍵名
???????? Dim key
???????? for each key in tab.keys
??????????? key.code= UCase(key.code)
???????? next
?? next
' 同理處理視圖
' Dim view
'?? for each view in folder.Views
?? '?? if not view.isShortcut then
?????? ' view.code = view.name
??? ' end if
' next
?? ' go into the sub-packages
?? Dim f ' running folder
?? For Each f In folder.Packages
????? if not f.IsShortcut then
???????? ProcessFolder f
????? end if
?? Next
end sub
總結(jié)
以上是生活随笔為你收集整理的PowerDesigner 表名、字段大小写转换的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 谷歌浏览器javascript调试教程
- 下一篇: 动态规划总结与题目分类