Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add a comment to an existing table column in SQL Server? [duplicate]

Tags:

Possible Duplicate:
SQL Comments on Create Table on SQL Server 2008

I just want to know how to add a comment to an existing table column in SQL Server? Seems simple, but I just don't find anything in the 5 first results that throw my search engine.

edits

Rather than using the UI, I would to know the SQL query.

like image 955
Rubens Mariuzzo Avatar asked Jan 26 '12 13:01

Rubens Mariuzzo


People also ask

How do you add a comment to a column in SQL?

Multi-line comments start with /* and end with */ . Any text between /* and */ will be ignored.


1 Answers

While creating a new table in SQL Server Management Studio, see this screenshot for adding a description to a column:

enter image description here

To do it programmatically:

EXEC sp_updateextendedproperty  @name = N'MS_Description', @value = 'Your description', @level0type = N'Schema', @level0name = dbo,  @level1type = N'Table',  @level1name = Your Table Name,  @level2type = N'Column', @level2name = Yuur Column Name; 
like image 74
Pankaj Avatar answered Oct 08 '22 13:10

Pankaj