SQL Server adds query tables and field comments

Source: Internet
Author: User
Welcome to the Windows community forum and interact with 3 million technical staff to enter the environment: xpsp3, sqlserver20081, SQL Server statement to annotate the table EXECUTEsp_addextendedpropertyNMS_Description, N table annotation, Nuser, Ndbo, Ntable, N table name, NULL, NULL2, SQL Server statement

Welcome to the Windows community forum and interact with 3 million technical staff> enter the environment: xp sp3, SQL server2008 1. use SQL Server statements to comment out EXECUTE sp_addextendedproperty N 'Ms _ description' to the table ', N 'table comment ', N 'user', N 'dbo', N 'table', N 'table name', NULL, NULL 2. SQL server uses a statement

Welcome to the Windows community forum and interact with 3 million technicians>

Environment: xp sp3, SQL server2008

1. SQL server uses statements to comment on tables

EXECUTE sp_addextendedproperty N 'Ms _ description', N 'table annotation', N 'user', N 'dbo', N 'table', N 'table name', NULL, NULL

2. "field" comment for the table using SQL Server statements

EXECUTE sp_addextendedproperty N 'Ms _ description', N 'field annotation', N 'user', N 'dbo', N 'table', N 'table name ', N 'column ', N 'field name'

3. View sqlserver comments

SELECT

A. name AS table_name,

B. name AS column_name,

C. value AS column_description

FROM sys. tables

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 = 'table name'

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.