• PowerDesigner中生成SQL SERVER2005字段注释 和导出图片的方法


    一 --SQLserver 生成字段说明的语句

    EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'字段说明' ,
    @level0type=N'SCHEMA', @level0name=N'dbo', @level1type=N'TABLE',
    @level1name=N'表名', @level2type=N'COLUMN', @level2name=N'列名'

    弹出了对话框。新建一个数据模型。在Name里面可以随便输入。Copy from选择SQLServer2005模型(如果没有,可以选择SQLServer2000)。保存模板。

    三 打开 SQL2005_User-》 Script-》 Column -》 ColumnComment


    编辑刚才的模板。
    输入上面的代码
    EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'%COMMENT%', @level0type=N'SCHEMA',@level0name=N'dbo',
    @level1type=N'TABLE',@level1name=N'%TABLE%', @level2type=N'COLUMN',@level2name=N'%COLUMN%'
    四 新建项目,选择刚才的模板。
    五 生成数据库,选择生成脚本

    /*==============================================================*/
    /* DBMS name:      mysqlserver                                  */
    /* Created on:     2021-07-21 11:07:40                          */
    /*==============================================================*/
    
    
    if exists (select 1
                from  sysobjects
               where  id = object_id('Device')
                and   type = 'U')
       drop table Device
    go
    
    /*==============================================================*/
    /* Table: Device                                                */
    /*==============================================================*/
    create table Device (
       DeviceId             varchar(50)          null,
       Ip                   varbinary(50)        null,
       sourceid             varchar(50)          null,
       devicename           varchar(50)          null,
       devicetype           varchar(50)          null,
       createtime           datetime             null,
       updatetime           datetime             null,
       createuser           varchar(50)          null,
       updateuser           varchar(50)          null,
       devicestate          int                  null
    )
    go
    
    if exists (select 1 from  sys.extended_properties
               where major_id = object_id('Device') and minor_id = 0)
    begin 
       declare @CurrentUser sysname 
    select @CurrentUser = user_name() 
    execute sp_dropextendedproperty 'MS_Description',  
       'user', @CurrentUser, 'table', 'Device' 
     
    end 
    
    
    select @CurrentUser = user_name() 
    execute sp_addextendedproperty 'MS_Description',  
       'Device', 
       'user', @CurrentUser, 'table', 'Device'
    go
    
    EXEC sys.sp_addextendedproperty @name=N'Description', @value=N'DeviceId', @level0type=N'SCHEMA',@level0name=N'dbo', 
    @level1type=N'TABLE',@level1name=N'Device', @level2type=N'COLUMN',@level2name=N'DeviceId'
    go
    
    EXEC sys.sp_addextendedproperty @name=N'Description', @value=N'Ip', @level0type=N'SCHEMA',@level0name=N'dbo', 
    @level1type=N'TABLE',@level1name=N'Device', @level2type=N'COLUMN',@level2name=N'Ip'
    go
    
    EXEC sys.sp_addextendedproperty @name=N'Description', @value=N'sourceid', @level0type=N'SCHEMA',@level0name=N'dbo', 
    @level1type=N'TABLE',@level1name=N'Device', @level2type=N'COLUMN',@level2name=N'sourceid'
    go
    
    EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'设备名称', @level0type=N'SCHEMA',@level0name=N'dbo', 
    @level1type=N'TABLE',@level1name=N'Device', @level2type=N'COLUMN',@level2name=N'devicename'
    go
    
    EXEC sys.sp_addextendedproperty @name=N'Description', @value=N'devicetype', @level0type=N'SCHEMA',@level0name=N'dbo', 
    @level1type=N'TABLE',@level1name=N'Device', @level2type=N'COLUMN',@level2name=N'devicetype'
    go
    
    EXEC sys.sp_addextendedproperty @name=N'Description', @value=N'createtime', @level0type=N'SCHEMA',@level0name=N'dbo', 
    @level1type=N'TABLE',@level1name=N'Device', @level2type=N'COLUMN',@level2name=N'createtime'
    go
    
    EXEC sys.sp_addextendedproperty @name=N'Description', @value=N'update time', @level0type=N'SCHEMA',@level0name=N'dbo', 
    @level1type=N'TABLE',@level1name=N'Device', @level2type=N'COLUMN',@level2name=N'updatetime'
    go
    
    EXEC sys.sp_addextendedproperty @name=N'Description', @value=N'createuser', @level0type=N'SCHEMA',@level0name=N'dbo', 
    @level1type=N'TABLE',@level1name=N'Device', @level2type=N'COLUMN',@level2name=N'createuser'
    go
    
    EXEC sys.sp_addextendedproperty @name=N'Description', @value=N'updateuser', @level0type=N'SCHEMA',@level0name=N'dbo', 
    @level1type=N'TABLE',@level1name=N'Device', @level2type=N'COLUMN',@level2name=N'updateuser'
    go
    
    EXEC sys.sp_addextendedproperty @name=N'Description', @value=N'devicestate', @level0type=N'SCHEMA',@level0name=N'dbo', 
    @level1type=N'TABLE',@level1name=N'Device', @level2type=N'COLUMN',@level2name=N'devicestate'
    go
    
    
    

    导出图片的方法

    全选 ctrl+a ,然后选择 编辑-》导出图像=》选择导出图片。(最好选svg格式,可以放大,不模糊)。如果导出图像按钮是灰色的,说明你没有执行全选。


    作者:过错
    出处:http://www.cnblogs.com/wang2650/
    关于作者:net开发做的久而已。十余年时光虚度!
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接。如有问题,可以邮件:wang2650@163.com  联系我,非常感谢。

  • 相关阅读:
    js实现打字机效果(完整实例)
    纯css高斯背景模糊(毛玻璃,伪元素,完整实例)
    vue首次缓存判断
    vue使用bus.js在兄弟组件传值
    叶子节点和tensor的requires_grad参数
    Mysql 8.x初次安装过程中遇到MySQL 服务无法启动的解决方法
    Apriori算法介绍(Python实现)
    springBoot单参数校验全局异常抛出
    解决vue 动态添加标签给标签添加自定义方法显示not function问题
    macbook pro、gitlab、SourceTree提交代码
  • 原文地址:https://www.cnblogs.com/wang2650/p/15038704.html
Copyright © 2020-2023  润新知