天天看點

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

PowerDesigner->Tools->Execute Commands->Edit/Run Scripts

代碼一:将Name中的字元COPY至Comment中

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

'****************************************************************************** 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

'*    File:            name2comment.vbs 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

'*    Purpose:      Database    generation    cannot    use    object    names    anymore   

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

'                          in    version    7    and    above. 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

'                          It    always    uses    the    object    codes. 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

'                          In    case    the    object    codes    are    not    aligned    with    your   

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

'                          object    names    in    your    model,    this    script    will    copy   

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

'                          the    object    Name    onto    the    object    Comment    for   

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

'                          the    Tables    and    Columns. 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

'*    Title:         

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

'*    Version:      1.0 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

'*    Company:      Sybase    Inc.   

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

Option   Explicit 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

ValidationMode   =   True 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

InteractiveMode   =    im_Batch 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

Dim    mdl   '    the    current    model 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

'    get    the    current    active    model 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

Set    mdl   =    ActiveModel 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

If    (mdl   Is   Nothing)   Then 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

      MsgBox   "There    is    no    current    Model " 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

ElseIf   Not    mdl.IsKindOf(PdPDM.cls_Model)   Then 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

      MsgBox   "The    current    model    is    not    an    Physical    Data    model. " 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

Else 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

       ProcessFolder    mdl 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

End   If 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

'    This    routine    copy    name    into    comment    for    each    table,    each    column    and    each    view 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

'    of    the    current    folder 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

Private   sub    ProcessFolder(folder) 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

      Dim    Tab   'running      table 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

      for   each    Tab    in    folder.tables 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

            if   not    tab.isShortcut   then 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

                   tab.comment   =    tab.name 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

                  Dim    col   '    running    column 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

                  for   each    col    in    tab.columns 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

                         col.comment=    col.name 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

                  next 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

            end   if 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

      next 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

      Dim    view   'running    view 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

      for   each    view    in    folder.Views 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

            if   not    view.isShortcut   then 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

                   view.comment   =    view.name 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

      '    go    into    the    sub-packages 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

      Dim    f   '    running    folder 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

      For   Each    f    In    folder.Packages 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

            if   not    f.IsShortcut   then 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

                   ProcessFolder    f 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

      Next 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

end   sub

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

代碼二:将Comment中的字元COPY至Name中

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

On Error Resume Next

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

                   tab.name   =    tab.comment

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

                  if col.comment="" then

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

                  else

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

                         col.name=    col.comment 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

                  end if

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼

                   view.name   =    view.comment 

【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼
【轉】PowerDesigner 中将Comment(注釋)及Name(名稱)内容互相COPY的VBS代碼