Go to SQL Server field description related operations SQL

Source: Internet
Author: User

You can query the system tables yourself: SELECT o.name as TableName, c.name as ColumnName, P.[value] as Descriptionfrom sysproperties p INNER JOIN s Ysobjects o o.id = p.id INNER JOIN syscolumns c on p.id = c.id and P.smallid = c.colidwhere (p.name = ' Ms_descript   Ion ') ORDER by o.name--Creating table and description information Create tables table (A1 varchar, a2 char (2))--Add description information to the table execute Sp_addextendedproperty N ' ms_description ', ' Personnel information table ', n ' user ', n ' dbo ', n ' table ', n ' Tables ', NULL, null--Add description information for field A1 execute Sp_addextend   Edproperty n ' ms_description ', ' name ', ' n ' user ', n ' dbo ', n ' table ', n ' tables ', n ' column ', n ' A1 '--Add description information for field A2 Execute Sp_addextendedproperty n ' ms_description ', ' Gender ', n ' user ', n ' dbo ', n ' table ', n ' tables ', n ' column ', n ' A2 '--Update table columns A1 Description attribute: EXEC sp_updateextendedproperty ' ms_description ', ' Field 1 ', ' user ', dbo, ' table ', ' table ', ' column ',   a1--Delete the Description property of the column A1 in the table: EXEC sp_dropextendedproperty ' ms_description ', ' user ', dbo, ' table ', ' Tables ', ' column ', a1--delete test drop table Table As for queries, SQL Server provides system functions Fn_listextendedpropertY ():---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 '

To SQL Server field description related operations SQL

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.