PowerDesigner 中將Comment(註釋)及Name(名稱)內容互相COPY的VBS程式碼(轉)
在用PowerDesigner時.常常在NAME或Comment中寫中文在Code中寫英文.Name只會顯示給我們看,Code會使用在程式碼中.但Comment中的文字會儲存到資料庫TABLE的Description中,有時候我們寫好了Name再寫一次Comment很麻煩.以下兩段程式碼就可以解決這個問題.
在PowerDesigner中按Ctrl + Shift + X,然後將下面的指令碼貼上進去,並執行,就可以
程式碼一:將Name中的字元COPY至Comment中
'******************************************************************************
'* File: name2comment.vbs
'* Purpose: Database generation cannot use object names anymore
' in version 7 and above.
' It always uses the object codes.
'
' In case the object codes are not aligned with your
' object names in your model, this script will copy
' the object Name onto the object Comment for
' the Tables and Columns.
'
'* Title:
'* Version: 1.0
'* Company: Sybase Inc.
'******************************************************************************
Option Explicit
ValidationMode = True
InteractiveMode = im_Batch
Dim mdl ' the current model
' 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
ProcessFolder mdl
End If
' This routine copy name into comment for each table, each column and each view
' of the current folder
Private sub ProcessFolder(folder)
Dim Tab 'running table
for each Tab in folder.tables
if not tab.isShortcut then
tab.comment = tab.name
Dim col ' running column
for each col in tab.columns
col.comment= col.name
next
end if
next
Dim view 'running view
for each view in folder.Views
if not view.isShortcut then
view.comment = 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
程式碼二:將Comment中的字元COPY至Name中
Option Explicit
ValidationMode = True
InteractiveMode = im_Batch
Dim mdl ' the current model
' 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
ProcessFolder mdl
End If
Private sub ProcessFolder(folder)
On Error Resume Next
Dim Tab 'running table
for each Tab in folder.tables
if not tab.isShortcut then
tab.name = tab.comment
Dim col ' running column
for each col in tab.columns
if col.comment="" then
else
col.name= col.comment
end if
next
end if
next
Dim view 'running view
for each view in folder.Views
if not view.isShortcut then
view.name = view.comment
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
ValidationMode = True
InteractiveMode = im_Batch
Dim mdl ' the current model
' 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
ProcessFolder mdl
End If
Private sub ProcessFolder(folder)
On Error Resume Next
Dim Tab 'running table
for each Tab in folder.tables
if not tab.isShortcut then
tab.name = tab.comment
Dim col ' running column
for each col in tab.columns
if col.comment="" then
else
col.name= col.comment
end if
next
end if
next
Dim view 'running view
for each view in folder.Views
if not view.isShortcut then
view.name = view.comment
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
---------------------------------------------------------------------
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/195110/viewspace-772771/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- PowerDesigner 中將Comment(註釋)及Name(名稱)內容互相COPY的VBS程式碼
- PowerDesigner 同步Name到Comment 及 同步 Comment 到Name
- (轉)PowerDesigner 把Comment寫到name中 和把name寫到Comment中 pd7以後版本可用
- PowerDesigner中通過VBS指令碼修改模型資訊指令碼模型
- Oracle comment新增註釋Oracle
- 如何拿到註解@ApiModelProperty(value = “單位名稱“, name = “orgName“)中的value值;API
- 註釋與反註釋Comment/Uncomment selected code in Visual C++ (轉)C++
- 《Oracle comment on註釋資訊方法論》Oracle
- 整理課程中將程式碼部署上線(Heroku)的內容
- Oracle PL/SQL程式碼中的註釋OracleSQL
- 將 Visual Studio .net 程式碼註釋 英文轉為中文
- 相鄰變數內容互相干擾的一個例子 (轉)變數
- 利用vbs指令碼將word文件轉換為pdf指令碼
- IDEA Plugins:Show Comment(快捷顯示註釋)安裝及使用IdeaPlugin
- php中抓取網頁內容的程式碼PHP網頁
- 語種名稱程式碼
- Myclipse中修改類註釋顯示作者名稱與當前日期
- php將內容轉為wordPHP
- PowerDesigner中name和code取消自動關聯
- 有趣的程式碼註釋
- 如何把程式碼中的註釋批次刪除
- 程式碼註釋中的5要與3不要
- IDEA中修改程式碼中的註釋顏色Idea
- PowerDesigner表名、列名大小寫轉換
- MongoDB db.serverStatus()輸出內容中文註釋MongoDBServer
- CSS程式碼註釋CSS
- php程式碼註釋PHP
- 程式碼才是最好的註釋
- 註釋程式碼的13技巧
- v$lock.type中的內容解釋
- 認識linux中的裝置名稱(轉)Linux
- ajax讀取檔案中內容的程式碼例項
- 怎樣使用程式碼得到bean:message 中的內容?Bean
- JavaScript中將JSONArray文字內容轉JSON物件陣列JavaScriptJSON物件陣列
- 請停止程式碼註釋
- javascript如何註釋程式碼JavaScript
- 正規表示式刪除Java程式碼中的註釋Java
- 使用VBS建立快捷方式的程式碼