Navi's

Necessity, the mother of invention

  • Visitor Map

    Locations of Site Visitors
  • Flag Counter

    free counters

How to Add/Update Table Column Description using Query

Posted by Navi's on January 19, 2010


You can get the Table Description using below query. It will show all descriptions from Database Selected Database.

SELECT * FROM sys.extended_properties

To Get the particular Table description we have to use another table named “INFORMATION_SCHEMA.Tables”. It will show all the tables of selected database.

To Add Column Description use this system Procedure

EXEC sp_addextendedproperty
@name = N'Caption' ,
@value = N'Put your Description Here.' ,
@level0type = N'Schema', 
@level0name = dbo ,
@level1type = N'Table',
@level1name = TABLENAME ,
@level2type = N'Column',
@level2name = COLUMNNAME; 

To Update Column Description use this system procedure

 EXEC sp_updateextendedproperty  

 @name = N'MS_Description' , 
 @value = 'Put your Description Here.' ,  
 @level0type = N'Schema',  
 @level0name = dbo ,  
 @level1type = N'Table', 
 @level1name = TABLENAME ,
 @level2type = N'Column', 
 @level2name = COLUMNNAME;

You can also reffer this url : http://msdn.microsoft.com/en-us/library/ms186885.aspx

-n’s

2 Responses to “How to Add/Update Table Column Description using Query”

  1. KulDeep said

    Thank you very much

    overall good efforts🙂

  2. Roberto said

    It’s really a nice and helpful piece of info. I’m satisfied that you simply shared this helpful info with us.
    Please stay us informed like this. Thank you for sharing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: