PowerDesigner 表名、字段大小写转换
面對不同的數據庫大小寫規范,一個個字段修改太麻煩了,如果使用了PowerDesigner設計,有比較簡單的方法。進入PowerDesigner,打開一個PDM,在菜單欄找到:Tools – Excute Commands – Edit/Run Script,或者直接按Ctrl+Shift+X調出腳本執行窗口,輸入下邊的代碼就可以了。使用的是VBScript,語義比較容易理解,可以根據自己的需求修改。
打開模型 Tools-->Execute Commands --> Edit/Run Script
UCase大寫 LCase小寫
輸入以下語句(根據實際情況可做相應調整)
Option Explicit
ValidationMode = True
InteractiveMode = im_Batch
Dim mdl ' the current model
' 取得當前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
總結
以上是生活随笔為你收集整理的PowerDesigner 表名、字段大小写转换的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 谷歌浏览器javascript调试教程
- 下一篇: JavaScript捕获窗口关闭事件