• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 292
  • Last Modified:

Retrieving table and column descriptions from SQL Server

In SQL Server's Enterprise manager I enter a line of documentation for each new table and column that I create.

 Is there an easy way to retrieve this information from the database such that it may be included in our system documentation?
1 Solution
Jay ToopsCommented:
See if this gives you what you need.

select so.name as [table] , sc.name as [type], st.name as [subtype], sc.length, sp2.name as xtype, sp2.value as comment
from sysobjects as so
inner join syscolumns as sc
on sc.id = so.id
inner join systypes as st
on sc.xusertype = st.xusertype
left outer join sysproperties as sp2
on sp2.id = so.id
and sp2.type = 4
and sp2.smallid = sc.colid
where so.xtype='u'
order by so.name

Try this query

pcpaascheAuthor Commented:
Thanks. I will try it out when I am back at the office on monday.

Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now