Link to home
Start Free TrialLog in
Avatar of mahmood66
mahmood66Flag for United Arab Emirates

asked on

how to get description of each field in sqlserver

i am using sql server 2003
dear experts, is there any query to get the description of my all fields of a specific table.

tell me if there is different query in sql server 2005, as i have sqlserver 2005 as well in other server.
description.JPG
Avatar of x-men
x-men
Flag of Portugal image

There is no such thing as Microsoft SQL Server 2003.
There is no SQL Server 2003.

The query is:

select * from syscolumns where id = (select id from sysobjects where type = 'U' and name = 'my table name')


Lee
Displaying extended properties on all columns in a table
The following example lists extended properties for columns in the ScrapReason table. This is contained in the schema Production.


USE AdventureWorks2008R2;
GO
SELECT objtype, objname, name, value
FROM fn_listextendedproperty (NULL, 'schema', 'Production', 'table', 'ScrapReason', 'column', default);
GO
 
search BOL for more about the "fn_listextendedproperty "
Actually, this is better:

select sc.name, st.name, sc.length from syscolumns sc
join systypes st on sc.xtype = st.xtype
where sc.id = (select id from sysobjects where type = 'U' and name = 'my table name')
ASKER CERTIFIED SOLUTION
Avatar of Sudhakar Pulivarthi
Sudhakar Pulivarthi
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mahmood66

ASKER

very nice.