April 21, 2004 at 9:06 am
In Enterprise Manager, in table design, you can enter a Description.
Does anyone know a query that will return the columns of a of a table and show the 'Description' property of the fields?
April 21, 2004 at 11:10 am
these descriptions are stored in the sysproperties system table (don't know if they are also stored in any INFORMATION_SCHEMA view) along with the object id of the table...
this query should (hopefully) return the column name and the description (if any):
DECLARE @TableName Varchar(100)
SET @TableName = 'xxxxxxxx'
SELECT
SC.name,
SP.value
FROM syscolumns SC LEFT OUTER JOIN sysproperties SP ON
SP.id = SC.id
WHERE SC.id = object_id(@TableName)
April 22, 2004 at 2:46 am
I've found a small change should eliminate repeating rows:
DECLARE @TableName Varchar(100)
SET @TableName = 'ASection'
SELECT
SC.name,
SP.value
FROM syscolumns SC LEFT OUTER JOIN sysproperties SP ON
SP.id = SC.id
and SC.colid = SP.smallid
WHERE SC.id = object_id(@TableName)
April 22, 2004 at 6:20 am
Thanks guys. This is exactly what I needed.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply