[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Retrieving table and column descriptions from SQL Server

Posted on 2004-09-01
2
Medium Priority
?
289 Views
Last Modified: 2006-11-17
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?
0
Comment
Question by:pcpaasche
2 Comments
 
LVL 10

Accepted Solution

by:
Jay Toops earned 500 total points
ID: 11951724
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

Jay
0
 

Author Comment

by:pcpaasche
ID: 11956673
Thanks. I will try it out when I am back at the office on monday.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Viewers will learn how the fundamental information of how to create a table.
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question