zoukankan      html  css  js  c++  java
  • 解决PowerDesigner 反向工程没有注释且如何将注释转换成PDM的name

    基本思路:
    1. 列注释且Name与注释一致
     新建一个自己的DBMS,在PD的 tools-->resources-->dbms-->新建一个DBMS,比如SqlServer2008_WAH,可以复制现有的sqlserver2008的模板。然后在这个模板的基础上修改其中的脚本内容
    修改地方:在general选项卡中选择新建的
    SqlServer2008_WAH-->script-->objects-->column-->SQLlistquery
    将原有的Value值替换为:
    {OWNER, TABLE, S, COLUMN, DTTPCODE, LENGTH, SIZE, PREC, COMPUTE, NOTNULL, IDENTITY, DOMAIN, DEFAULT, ExtIdentitySeedInc, COMMENT, COLNNAME,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),
       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
     
    2. 表注释
    修改地方:在general选项卡中选择新建的
    SqlServer2008_WAH-->script-->objects-->table-->SQLlistquery
    将原有的Value值替换为:

    {OWNER, TABLE, TABLE_TYPE, COMMENT}

    select
       u.name,
       o.name,
       case (o.type) when 'S' then 'SYSTEM TABLE' else 'TABLE' end
       ,convert(varchar(8000), e.value) as coln
    from
       [%CATALOG%.]sys.sysobjects o
       join [%CATALOG%.]sys.schemas  u on (u.schema_id = o.uid)
       left join [%CATALOG%.]sys.extended_properties e on (e.class=u.schema_id and e.major_id=o.id and e.minor_id=0 and e.name=N'MS_Description')
    where
       o.type in ('U', 'S')
    [  and u.name = %.q:OWNER%]
    order by 1, 2

  • 相关阅读:
    java开发——Cloneable接口、clone()方法和深浅拷贝
    intellij idea 显示Arraylist 扩容过程 解决not showing null elements
    ArrayList的扩容方式和扩容时机
    【laravel5.4】发送alisms短信和163邮箱
    【laravel5.4】重定向带参数
    【laravel5.4】vue分页删除
    【laravel5.4】Baum无限极分类和collect助手函数、transform()中间件(转换数据)方法使用
    【laravel5.4】使用baum ode 类库实现无限极分类
    【VUE+laravel5.4】vue给http请求 添加请求头数据
    【laravel5.4】关键字【use】使用
  • 原文地址:https://www.cnblogs.com/56411808/p/1984857.html
Copyright © 2011-2022 走看看