SQL Server database Dictionary maintenance method

Source: Internet
Author: User

Enable SQL Server Enable manager, take 2008 as an example
1. Set Table information description
    • Select the table you want to set, right-click on "Properties"

    • Select Extended Properties

Fill in the requirements:

Name: ms_description

Value: module name-table name

modifying statements

DECLARE @tableName varchar (200)

DECLARE @tableDesc varchar (200)

DECLARE @sql varchar (8000)

DECLARE @c int

Set @tableName = N ' B_YHBM '; --Table name

Set @tableDesc = N ' Organization-person login information '; --Description information (requires module + table description) such as main program-Permission category

--Determine if you have completed

Select @c = COUNT (*) from sys.extended_properties a WHERE a.major_id = object_id (@TableName) and name = ' Ms_description ' A nd minor_id = 0;

IF @c <= 0

BEGIN--Add

EXEC [SYS]. [Sp_addextendedproperty] @name = n ' ms_description ', @value = @tableDesc, @level0type = N ' SCHEMA ', @level0name = n ' dbo ', @l Evel1type = N ' TABLE ', @level1name = @tableName;

END

ELSE

BEGIN--Modify

EXEC [SYS]. [Sp_updateextendedproperty] @name = n ' ms_description ', @value = @tableDesc, @level0type = N ' SCHEMA ', @level0name = n ' dbo ', @level1type = N ' TABLE ', @level1name = @tableName;

END

GO

2, fill in paragraph description

Select the table you want to set, right-click on "Design"

3. Output information

See http://www.cnblogs.com/netWild/archive/2013/04/19/3031734.html

Output execution statement SQL statement. txt

Output effect:

SQL Server database Dictionary maintenance method

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.