Home  >  Article  >  Database  >  sqlserver添加查询表、字段注释

sqlserver添加查询表、字段注释

WBOY
WBOYOriginal
2016-06-07 15:51:212984browse

欢迎进入Windows社区论坛,与300万技术人员互动交流 >>进入 环境:xp sp3,sql server2008 1、sqlserver用语句给表注释 EXECUTE sp_addextendedproperty N'MS_Description', N'表注释', N'user', N'dbo', N'table', N'表名', NULL, NULL 2、sqlserver用语句给

欢迎进入Windows社区论坛,与300万技术人员互动交流 >>进入

  环境: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 = '表名'

sqlserver添加查询表、字段注释

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn