Viewing SQL Server 2005 Column Properties

Is there a way to view the Column Properties / Table Designer / Description using an SQL Server 2005 Query.
CDFA_Inc2Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CDFA_Inc2Author Commented:
SELECT objname,value
FROM fn_listextendedproperty(NULL, 'user', 'dbo', 'table', 'tablename', 'column', NULL or columnName)
CDFA_Inc2Author Commented:
If there are any other ways let me know and I will accept your answer.
john-m-calvertCommented:
How about the following:

-- using sysproperties

select o.name 'table', '' 'column', 0 'position', p.*
from sysobjects o
      left join sysproperties p on o.id = p.id and p.smallid = 0
where o.type = 'u'
 -- include this filter to obtain only those tables with no extended properties
 -- and p.id is null

union

select o.name 'table', c.name 'column', c.colorder 'position', p.*
from sysobjects o
      inner join syscolumns c on o.id = c.id
      left join sysproperties p on c.id = p.id and c.colid = p.smallid
where o.type = 'u'
 -- include this filter to obtain only those columns with no extended properties
 -- and p.id is null

order by o.name, position, p.name
Ved Prakash AgrawalDatabase Consultant/Performance ArchitectCommented:
This Script made only for SQL SERVER 2005 :
This Script will not work for other sql version.

This Query wil provide you Description for every columns if you Specify


select o.name As TableName, c.Name As ColumnName, p.value AS Description
from sys.objects o INNER JOIN sys.Columns c
            On o.Object_id = c.object_id
     left join sys.extended_properties p on o.object_id = p.Major_id
            And p.minor_id = c.Column_Id
      
where o.type = 'u'

Result Look Like This
TableName             ColumnName  Description
AccountRoleMatrix      AccountID      Foreign Key from acct_Accounts table for mapping with clients Accounts
AccountRoleMatrix      RoleId      Foreign Key from RoleMatrix table to identify the Role
AccountRoleMatrix      FeatureID      Foreign Key from RoleMatrix table to identify the Feature
AccountRoleMatrix      FeatureName      Foreign key from Features table maintaining the name/description of the Feature
AccountRoleMatrix      IsDeleted      0/1 indicating whether the record is deleted or not



Cheers!!!!!!

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Databases

From novice to tech pro — start learning today.