Is it possible to add description for column while creating table in MSSQL QUERY. I am in need to add description for columns in table while moving data to the table.
Asked
Active
Viewed 741 times
0
-
The descriptions are extended properties (I believe the name is literally `MSDescription`) and can be set with `sp_addextendedproperty`/`sp_updateextendedproperty` and retrieved with `fn_listextendedproperty`. There is no direct support within DDL statements for them (`CREATE TABLE`, etc.) – Jeroen Mostert Jun 25 '20 at 13:08
1 Answers
2
It's clunky in SQL Server. For some reason, they've never adopted the COMMENT
syntax, and you can't add the comments directly in the CREATE TABLE
statement.
After your CREATE
statement, run the system stored procedure sp-addextendedproperty
There's an extended conversation on the topic under this question: SQL Comments on Create Table on SQL Server 2008

Eric Brandt
- 7,886
- 3
- 18
- 35