1.我的表

[id],[name],[type],[date]四个字段,,,表名是library

<h1>2.添加列描述</h1>
姓名:描述信息
library:表名
被描述字段:name

  EXECUTE sp_addextendedproperty N\'MS_Description\', \'姓名\', N\'user\', N\'dbo\', N\'table\', N\'library\', N\'column\', N\'name\'

name字段添加"姓名"描述信息

<h1>3.删除描述</h1>
library:表名
name:有描述信息的字段

  EXEC sp_dropextendedproperty \'MS_Description\',\'user\',dbo,\'table\',\'library\',\'column\',name

<h1>4.查看描述情况</h1>
library:要查看的表(查出该表的所有字段描述信息)

  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 = \'library\'

摘自:https://www.cnblogs.com/wangshenhe/p/3178039.html

版权声明:本文为jsll原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/jsll/archive/2004/01/13/11753336.html