March 2, 2012 at 11:19 am
The following script lists the extented properties for each table in a database:
SELECT OBJECT_NAME(ep.major_id) AS [ObjectName],
CAST(Value AS nvarchar(500)) AS [MS_Description]
FROM sys.extended_properties AS ep
WHERE ep.name = N'MS_Description' AND ep.minor_id = 0
ORDER BY OBJECT_NAME(ep.major_id)
I need a script that list the extended properties for every column in every table in a database.
Any help would be greatly appreciated.
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
March 2, 2012 at 12:25 pm
Did u look at BOL? http://msdn.microsoft.com/en-us/library/ms177541.aspx
SELECT OBJECT_NAME(ep.major_id) AS [ObjectName],
CAST(Value AS nvarchar(500)) AS [MS_Description]
FROM sys.extended_properties AS ep
WHERE ep.class = 1 AND ep.minor_id = 1
ORDER BY OBJECT_NAME(ep.major_id)
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
March 3, 2012 at 6:57 am
Sean,
I looked at BOL but obviously not good enough.
Thank you.
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
March 3, 2012 at 7:04 am
Sean,
Each table is duplicated in a different schema.
Unfortunately I do not see a way to include the schema as a column and include that in the sort.
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
March 5, 2012 at 8:40 am
Well you already have the OBJECT_ID so it is pretty simple.
SELECT OBJECT_NAME(ep.major_id) AS [ObjectName],
CAST(Value AS nvarchar(500)) AS [MS_Description]
,OBJECT_SCHEMA_NAME(ep.major_id) as SchemaName
FROM sys.extended_properties AS ep
WHERE ep.class = 1 AND ep.minor_id = 1
ORDER BY OBJECT_NAME(ep.major_id), OBJECT_SCHEMA_NAME(ep.major_id)
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
March 5, 2012 at 10:27 am
Thanks!
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
Viewing 6 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply