Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Accessing column description from schema

Author  Topic 

BiGPapa
Starting Member

4 Posts

Posted - 2007-04-25 : 15:14:43
Anyone know how to pull a column descritpion with a query?

spejbl
Starting Member

28 Posts

Posted - 2007-04-25 : 15:28:06
[code]SELECT value
FROM ::fn_listextendedproperty('MS_Description','USER','dbo','TABLE',NULL,NULL,NULL)
WHERE objname='YourTable'[/code]--
Tom
Microsoft KB articles monitoring | Apple KB articles monitoring
Go to Top of Page

BiGPapa
Starting Member

4 Posts

Posted - 2007-04-25 : 16:10:28
Thanks, I've never used fn_listextendedproperty before. However, using I am returning no records with the query, though it is executing without error. I looked up the documentation on fn_listextendedproperty (http://msdn2.microsoft.com/en-us/library/ms179853.aspx) and came up with a query that seems to make sense to me. It runs without an error as well but still I have no records returned. Any suggestions?

SELECT *
FROM ::fn_listextendedproperty (NULL, 'schema', 'dbo', 'table', 'MyTable', 'column', 'MyColumn');
GO
Go to Top of Page

pbguy
Constraint Violating Yak Guru

319 Posts

Posted - 2007-04-26 : 00:42:13
below query lists all the column of the table specified

select sc.* from syscolumns sc, sysobjects so where sc.id = so.id and
so.name ='your table' and so.type ='U'
Go to Top of Page

BiGPapa
Starting Member

4 Posts

Posted - 2007-04-26 : 10:40:21
Actually what I am trying to access is depicted below. The user defined description associated with a specific column.

Go to Top of Page

spejbl
Starting Member

28 Posts

Posted - 2007-04-26 : 11:00:55
[code]SELECT value
FROM ::fn_listextendedproperty(N'MS_Description', N'user', N'dbo', N'table', N'YourTableName', N'column', N'YourColumnName')
[/code]

--
Tom
Microsoft KB articles monitoring | Apple KB articles monitoring
Go to Top of Page

BiGPapa
Starting Member

4 Posts

Posted - 2007-04-26 : 11:57:30
yes, that's it thank you!
Go to Top of Page
   

- Advertisement -