Introduction to SQL Server Extended Properties _mssql

Source: Internet
Author: User

The description of Extended properties in SQL Server Help is:
The Extended Properties Sets or retrieves provider-specific connection information that cannot is explicitly desc Ribed through the property mechanism.
The following actions are available for extended properties:

Copy Code code as follows:

EXEC sp_addextendedproperty n ' ms_description ', n ' field description ', n ' user ', n ' dbo ',

n ' table ', n ' list name ', N ' column ', n ' field name '
Go


For example: EXEC sp_addextendedproperty n ' ms_description ', n ' address ', n ' user ', dbo,n ' table ',
Copy Code code as follows:

N ' a ', N ' column ', A_add
go--My table is a, to add a field description to the field A_add: Address

Other Related:

Delete:

Copy Code code as follows:

EXEC sp_dropextendedproperty n ' ms_description ', n ' user ', dbo,n ' table ', n ' list name ',

N ' column ', field name


Modify:
Copy Code code as follows:

EXEC sp_updateextendedproperty n ' ms_description ', n ' field description ', n ' user ',

Dbo,n ' table ', N ' tables name ', ' column ', field


As for queries, SQL Server provides system functions Fn_listextendedproperty ():
Copy Code code as follows:

--Get a description of a field
SELECT *
From:: Fn_listextendedproperty (NULL, ' user ', ' dbo ', ' table ', ' table name ', ' column ',

Default)--other variables, according to your request you can write, as long as the table name for your
where objname = ' field name '


You can also query the system tables yourself:
Copy Code code as follows:

SELECT O.name as TableName, c.name as ColumnName, P.[value] as Description
From Sysproperties P INNER JOIN
sysobjects o on o.id = p.id INNER JOIN
syscolumns C on p.id = c.id and p.smallid = C.colid
WHERE (p.name = ' ms_description ')
ORDER BY O.name

Related Article

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.