zoukankan      html  css  js  c++  java
  • 记录-powerDesigner 导入sql文件注释问题

    powerDesigner 导入sql文件

      1.首先字段注释未能成功导入

      2.物理模型不能显示注销。

    powerDesigner 导入sql文件

     

     

    一、字段注释未能成功导入的解决方案:

    在PD的 tools-->resources-->dbms-->sql server 2008打开DBMS属性窗口,在general选项卡中选择Microsoft SQL Server 2008-->script-->objects-->column-->SQLlistquery修改其中的内容为:

    注:我的PD没找到sql server 2008,所以我修改的是mysql5.0的内容。运行sql文件的时候选择的也是mysql5.0。

    {OWNER, TABLE, S, COLUMN, DTTPCODE, LENGTH, SIZE, PREC, COMPUTE, NOTNULL, IDENTITY, DOMAIN, DEFAULT, ExtIdentitySeedInc, COMMENT, ExtCollation, ExtIdtNotForReplication, ExtDeftConstName, Sparse, FileStream, ExtRowGuidCol}
    
    select
    u.name,
    o.name,
    c.column_id,
    c.name,
    case when c.system_type_id in (165, 167, 231) and c.max_length = -1 then t.name + '(Max)' else t.name end,
    c.precision,
    case (c.max_length) when -1 then 0 else case when c.system_type_id in (99, 231, 239) then (c.max_length/2) else (c.max_length) end end as colnA,
    c.scale,
    case(c.is_computed) when 1 then convert(varchar(8000), (select z.definition from [%CATALOG%.]sys.computed_columns z where z.object_id = c.object_id and z.column_id = c.column_id)) else '' end as colnB,
    case(c.is_nullable) when 1 then 'NULL' else 'NOTNULL' end,
    case(c.is_identity) when 1 then 'identity' else '' end,
    case when(c.user_type_id <> c.system_type_id) then (select d.name from [%CATALOG%.]sys.types d where d.user_type_id = c.user_type_id) else '' end as colnC,
    convert(varchar(8000), d.definition),
    case (c.is_identity) when 1 then convert(varchar, i.seed_value) + ', ' + convert(varchar, i.increment_value) else '' end as colnD,
    convert(varchar(8000),e.value),
    c.collation_name,
    case (i.is_not_for_replication) when 1 then 'true' else 'false' end,
    d.name,
    case(c.is_sparse) when 1 then 'true' else 'false' end,
    case(c.is_filestream) when 1 then 'true' else 'false' end,
    case(c.is_rowguidcol) when 1 then 'true' else 'false' end
    from
    [%CATALOG%.]sys.columns c
    join [%CATALOG%.]sys.objects o on (o.object_id = c.object_id)
    join [%CATALOG%.]sys.schemas u on (u.schema_id = o.schema_id)
    join [%CATALOG%.]sys.types t on (t.user_type_id = c.system_type_id)
    left outer join [%CATALOG%.]sys.identity_columns i on (i.object_id = c.object_id and i.column_id = c.column_id)
    left outer join [%CATALOG%.]sys.default_constraints d on (d.object_id = c.default_object_id)
    left outer join [%CATALOG%.]sys.extended_properties e on (e.class=u.schema_id and e.major_id=o.object_id and e.minor_id = c.column_id and e.name=N'MS_Description')
    where
    o.type in ('U', 'S', 'V')
    [ and u.name = %.q:OWNER%]
    [ and o.name=%.q:TABLE%]
    order by 1, 2, 3

    二、物理模型不能显示注销解决方案:

    Tools>Display Perferences..

    进入 Table, 先勾选 Comment

    点击add Attribute 找到code打勾确定

    再点击 Advanced -> Columns , 点击 List columns 右边的按钮 select , 选择上 code, 并将位置调的最上方, 点击确定

    Tools>Execute Commands>Edit/Run Script.., 执行下面的脚本, 脚本的作用是将 NAME 替换成 COMMENT

    Option   Explicit   
            ValidationMode   =   True   
            InteractiveMode   =   im_Batch
            Dim blankStr
            blankStr   =   Space(1)
            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 = "" or replace(col.comment," ", "")="" Then
                                    col.name = blankStr
                                    blankStr = blankStr & Space(1)
                              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
  • 相关阅读:
    dos
    jsf session的获取和添加
    tomcat多开造成的端口占用
    myeclipse中tomcat7内存大小的设置
    中文传值乱码过滤
    java定时器
    jsf中jstl标签<c:forEach/>打印信息
    python基础python函数any()与all()的区别
    C# GetManifestResourceStream获取资源为null
    Linux kill 9 和 kill 15 的区别
  • 原文地址:https://www.cnblogs.com/qlnx/p/14708708.html
Copyright © 2011-2022 走看看