• sqlserver添加查询 表、字段注释(转)


    环境:xp sp3,sql server2008
    
    1、sqlserver用语句给表注释
    EXECUTE sp_addextendedproperty N'MS_Description', N'表注释', N'user', N'dbo', N'table', N'表名', NULL, NULL
    
    2、sqlserver用语句给表的“字段”注释
    EXECUTE sp_addextendedproperty N'MS_Description', N'字段注释', N'user', N'dbo', N'table', N'表名', N'column', N'字段名'
    
    3、查看sqlserver注释
    
    SELECT
    A.name AS table_name,
    B.name AS column_name,
    C.value AS column_description
    FROM sys.tables A
    INNER JOIN sys.columns B ON B.object_id = A.object_id
    LEFT JOIN sys.extended_properties C ON C.major_id = B.object_id AND C.minor_id = B.column_id
    WHERE A.name = '表名'

    SELECT
    --A.name AS table_name,
    CAST(ISNULL(B.NAME,'') AS NVARCHAR(100))+', --'+CAST(ISNULL(C.value,'') AS NVARCHAR(100)) AS column_name
    --,C.value AS column_description
    FROM sys.tables A
    INNER JOIN sys.columns B ON B.object_id = A.object_id
    LEFT JOIN sys.extended_properties C ON C.major_id = B.object_id AND C.minor_id = B.column_id
    WHERE A.name = 'ExpertDB'

    SELECT

    --A.name AS table_name,
    ' --'+CAST(ISNULL(C.value,'') AS NVARCHAR(100)) AS column_name
    --,C.value AS column_description
    FROM sys.tables A
    INNER JOIN sys.columns B ON B.object_id = A.object_id
    LEFT JOIN sys.extended_properties C ON C.major_id = B.object_id AND C.minor_id = B.column_id
    WHERE A.name = 'ExpertDB'

    
    
    转自:http://begoodluck.blog.163.com/blog/static/20450728020141191412788/
  • 相关阅读:
    控件属性大全(持续更新)
    STM32F0使用LL库实现UART接收
    STM32F0 LL库IIC第二地址配置错误
    C# 抽象类小谈
    DevExpress 动态换肤
    DevExpress ChartControl大数据加载时有哪些性能优化方法
    Devexpress WPF ChartControl 多Y轴
    Lambda表达式的使用
    Prism--MVVM 之Command
    WPF Toolkit Chart--动态换列
  • 原文地址:https://www.cnblogs.com/xyzhuzhou/p/4863987.html
Copyright © 2020-2023  润新知