March 21, 2011 at 8:08 pm
Comments posted to this topic are about the item Extracting Extended Properties
March 22, 2011 at 7:28 am
Cool. The Word template is what I've been looking for. I built an aspx app to display table columns in a grid, but could not figure out how to get our doc pages in SharePoint to embed that output.
For a particular table, I wanted the column attributes as well as the description info, so used something like this:
SELECT C.ColumnName, DataType, Length, NullsAllowed, DefaultValue, Description FROM
(SELECT COLUMN_NAME AS ColumnName,
DATA_TYPE AS DataType,
CHARACTER_MAXIMUM_LENGTH AS Length,
IS_NULLABLE AS NullsAllowed,
COLUMN_DEFAULT AS DefaultValue
FROM Information_Schema.Columns
WHERE Table_Name = @Table) AS C
LEFT OUTER JOIN
(SELECT objname AS ColumnName, value AS Description
FROM fn_listextendedproperty (Default, 'schema', 'dbo', 'table', @Table, 'column', default)
WHERE name = 'MS_Description') AS D
ON C.ColumnName COLLATE Latin1_General_CI_AS = D.ColumnName
March 22, 2011 at 7:35 am
Nice one cjs - shows how much you can do with this - and in so many ways - when you try!
March 22, 2011 at 9:45 am
Great article/ series! Makes me want to start documenting my databases! (Yea, I'm way behind on that)
Your first image depicting the sys.extended_properties view looks different from mine. I'm running SS2008R2, and my columns match your article description (ie major_id, minor_id, name, value), but your image has column names of PropertyType, SchemaName, TableName, etc). Was that the wrong image, or did you join the sys.extended_properties view to other system views?
Thanks!
patrick
March 22, 2011 at 9:52 am
Hi Patrick,
Thanks for the feedback, and you are quite right, this is the wrong image. I'll try & correct, but it might be a day or two...
All the best,
Adam
March 22, 2011 at 10:36 am
Excellent article and great material. Thanks for the template and script too.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
May 3, 2011 at 4:35 pm
An excellent set of articles. Does anyone know how to return the extended properties of Database Roles in the same way?
Damian
May 3, 2011 at 6:23 pm
damian.wise (5/3/2011)
An excellent set of articles. Does anyone know how to return the extended properties of Database Roles in the same way?Damian
Apply with:
EXEC sys.sp_addextendedproperty
@name=N'name',
@value=N'value',
@level0type=N'USER',
@level0name=N'databaserole'
Query with:
SELECT *
FROM sys.extended_properties AS xp
INNER JOIN sys.database_principals AS dp
ON xp.major_id = dp.principal_id
AND xp.class_desc = 'DATABASE_PRINCIPAL'
Viewing 8 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy