all groups > sql server programming > october 2005 >
You're in the

sql server programming

group:

SQL Table Fields Description


SQL Table Fields Description Constantin Chionas
10/11/2005 10:49:02 PM
sql server programming:
How we can read the specified Description of the fields in SQL table from
another software like VB or VFP?

Re: SQL Table Fields Description Dejan Sarka
10/12/2005 12:00:00 AM
[quoted text, click to view]

use INFORMATION_SCHEMA views (TABLES, COLUMNS and other) to get the schema
information. If you are talking about extended properties, then this article
should help you: http://developer.com/db/article.php/3361751.

--
Dejan Sarka, SQL Server MVP
Mentor
www.SolidQualityLearning.com

Re: SQL Table Fields Description Constantin Chionas
10/12/2005 12:28:02 AM
I will use the following:

SELECT *
FROM ::fn_listextendedproperty ('MS_Description', 'user', 'dbo', 'table',
<Table Name>, 'column', <Field Name>)

Thank you Dejan.

[quoted text, click to view]
Re: SQL Table Fields Description Anith Sen
10/12/2005 8:35:04 AM
The descriptions for each of the column in the table are stored in a system
table called sysproperties, but it is not documented in SQL Server Books
Online. So accessing this table directly is not generally recommended
however, you can do the following in t-SQL:

SELECT s2.id, s1.name,
( SELECT s3.value
FROM sysproperties s3
WHERE s3.id = s1.id
AND s3.smallid = s1.colid ) AS "col desc"
FROM syscolumns s1
INNER JOIN sysobjects s2
ON s1.id = s2.id
WHERE s2.name = @tbl ;

If you are looking for a documented method, you can use a system function
called fn_listextendedproperty.

SELECT *
FROM ::fn_listextendedproperty (
NULL, 'user', 'dbo', 'table', 'tbl', 'column', DEFAULT ) ;

More details on using extended properties, along with examples, can be found
in SQL Server Books Online.

--
Anith

AddThis Social Bookmark Button