***************** 花有重开日,人无再少年。**************
sql文件中添加生成字段备注
1.在设计概念模型数据时,Name后期为字段备注信息来源,Code为主数据字段
2.转换:cdm -> ldm - > pdm ,转换到物理模型的时候进行设置
①.转到物理模型进行如下操作:Tools -> Display Preferences
②.点击Advanced,打开对应的设置界面
③.点击Columns -> List columns
④.把Code勾选上,一路ok即可
3.设置完成以上步骤后,下一轮操作:Tools -> Execute Commands -> Edit/Run Script
①.打开edit界面:
②.将下面的脚本拷贝到edit中,Run执行
-- Name中的字符COPY至Comment中
'代码一:将Name中的字符COPY至Comment中 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替换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
4.双击打开对应的表就能看到以下显示
5.脚本执行完毕后Database下导出sql脚本还原到数据库进行对应的表查看