[dba-SQLServer] Where do I find

Bobby Heid bheid at sc.rr.com
Thu Dec 6 21:05:33 CST 2007


I found this little snippet that works in SQL 2005.  You should be able to
modify it for your purposes.  Note that the table I was searching on is
videos in the line:    AND OBJECT_NAME(c.object_id) = 'videos'

SELECT  
    [Table Name] = OBJECT_NAME(c.object_id), 
    [Column Name] = c.name, 
    [Description] = ex.value  
FROM  
    sys.columns c  
LEFT OUTER JOIN  
    sys.extended_properties ex  
ON  
    ex.major_id = c.object_id 
    AND ex.minor_id = c.column_id  
    AND ex.name = 'MS_Description'  
WHERE  
    OBJECTPROPERTY(c.object_id, 'IsMsShipped')=0  
    AND OBJECT_NAME(c.object_id) = 'videos' 
ORDER  
    BY OBJECT_NAME(c.object_id), c.column_id

Bobby

-----Original Message-----
From: dba-sqlserver-bounces at databaseadvisors.com
[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of jwcolby
Sent: Thursday, December 06, 2007 2:54 PM
To: dba-sqlserver at databaseadvisors.com
Subject: [dba-SQLServer] Where do I find

What would the SQL look like to get a list of all the field names in a
table?  I assume that there are system tables with this stuff but it is kind
of slow poking around trying to find that.

John W. Colby
Colby Consulting
www.ColbyConsulting.com 





More information about the dba-SQLServer mailing list