Important alert: (current site time 7/15/2013 7:04:28 PM EDT)
 

VB icon

Column Descriptions

Email
Submitted on: 3/14/2007 8:24:06 AM
By: John C Kirwin  
Level: Intermediate
User Rating: By 4 Users
Compatibility: SQL Server 2000
Views: 9525
author picture
(About the author)
 
     A great way to keep track of the original intent of the developer is to add descriptions to columns of the tables in your database (see below using Enterprise Manager). This little query can assist with documentation and training at a later date. Enhance it to meet your own needs...and share your improvements with us right here on PSC!!

 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.
				
--**************************************
-- Name: Column Descriptions
-- Description:A great way to keep track of the original intent of the developer is to add descriptions to columns of the tables in your database (see below using Enterprise Manager). This little query can assist with documentation and training at a later date. Enhance it to meet your own needs...and share your improvements with us right here on PSC!!
-- By: John C Kirwin
--
--This code is copyrighted and has-- limited warranties.Please see http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=1129&lngWId=5--for details.--**************************************

SELECT SO.Name, SC.NAME, SP.value 
FROM sysobjects SO 
INNER JOIN EmailLog..syscolumns SC 
 ON SO.id = SC.id 
LEFT OUTER JOIN EmailLog..sysproperties SP 
 ON SC.id = SP.id 
 AND SC.colid = SP.smallid
WHERE SO.type in ('S', 'U')


Other 8 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

3/14/2007 11:01:46 AMhsanguino

Perfect!
The only thing we must to do is replace the "EmailLog" with the name of our own database, and maybe add this code at last line of the query: "AND VALUE IS NOT NULL" so that show only those columns with Descriptions.

Thank You! this query is going to my top 10 SQL-TIPS Library.
(If this comment was disrespectful, please report it.)

 
3/14/2007 11:22:00 AMJohn C Kirwin

Please note that "EmailLog" was the database name in the code! If you don't change it...you get an error...doh!
(If this comment was disrespectful, please report it.)

 
3/27/2007 5:38:35 AMronny

i was try your code on my sql2005 and it's
doesn't work. can you tell me why
(If this comment was disrespectful, please report it.)

 
5/7/2007 4:01:51 AMMeena Negi

I want to remove ''codes from a database table's column values. So please tell me how can I do it.
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.