How To Get Column Description In SQL Server

We can get column descriptions or extended properties in SQL Server using different approaches. In this article, I will walk you through multiple approaches to do this.

How To Get Column Description In SQL Server

Let us discuss all those approaches individually.

Approach-1: Using SQL Server Management Studio (SSMS)

To get column description in SQL Server, follow the steps below.

1. Open SQL Server Management Studio and connect to your SQL server database instance.

2. Expand the Databases folder, and then expand the specific database folder, right-click on the table name, and then select the Design option as shown in the screenshot below.

get column description sql server

3. See the Column Properties section as shown below.

get column description in sql server

Approach-2: Using INFORMATION_SCHEMA.COLUMNS

We can query INFORMATION_SCHEMA.COLUMNS like below.

SELECT COLUMN_NAME, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'AzureUSA'

After executing the above query, I got the expected output, as shown in the screenshot below.

How To Get Column Description In SQL Server

Approach-3: Using sys.extended_properties

We can also query the sys.extended_properties using the below query.

SELECT 
    c.name AS ColumnName,
    ep.value AS ColumnDescription
FROM sys.columns c
LEFT JOIN sys.extended_properties ep ON ep.major_id = c.object_id
    AND ep.minor_id = c.column_id
WHERE c.object_id = OBJECT_ID('AzureUSA')

After executing the above query, I got the expected output, as shown in the screenshot shown below.

sql server column description metadata

Approach-4: Using sp_help stored procedure

We can also execute the sp_help stored procedure like the one below for this purpose.

EXEC sp_help 'AzureUSA'

After executing the above query, I got the column description details below, as shown in the screenshot below.

how to get column metadata in sql server

Conclusion

As a developer or SQL DBA, you should know the ways to get column description in SQL Server. You can use any of the approaches mentioned in this article to achieve this.

You may also like following the articles below.

Top 200 SQL Server Interview Questions and Answers

Free PDF On Top 200 SQL Server Interview Questions And Answers

Download A 40 pages PDF And Learn Now.