Developing Matt

My Technical Journal

Vew extended properties

leave a comment »

I wish that ssms had a way to add a note to a table, but it doesn’t.  Instead it has an extended properties to each object (table, column, etc).  This is pretty handy and helpful but not quick and no one uses it. 

I’d like to place notes in the columns that I create to explain the purpose of each.  maybe I will create a view and modify the adopted code that I found on Amit’s blog.  Thanks Amit! GREAT STUFF!!!

SELECT [sys].[objects].[name] AS [ObjectName] 

,[sys].[objects].[name] as [Property] 

,[sys].[extended_properties].[value] AS [PropertyValue] 

,[syscolumns].[name] AS [ColumnName]

FROM

[sys].[objects] 

INNER JOIN [sys].[extended_properties] ON [sys].[objects].[object_id] =

[sys]

.[extended_properties].[major_id] 

INNER JOIN [sys].[schemas] ON [sys].[objects].[schema_id] =

[sys]

.[schemas].[schema_id] 

LEFT JOIN [syscolumns] ON [sys].[extended_properties].[minor_id] =

[syscolumns]

.[colid] 

AND [sys].[extended_properties].[major_id] = [syscolumns].[id]

WHERE

[sys].[objects].[type] = ‘U’

AND

[sys].[objects].[Name] <> ‘sysdiagrams’

Advertisements

Written by matt

January 26, 2009 at 3:36 pm

Posted in T-Sql

Tagged with

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: