SQL get optionset details

The followin SQL can be used to retrieve information about optionsets in all entitesSELECT  EntityView.Name AS EntityName, LocalizedLabelView_1.Label AS EntityDisplayName,
AttributeView.Name AS AttributeName, LocalizedLabelView_2.Label AS AttributeDisplayName,
Stringmap.Value,Stringmap.AttributeValue,StringMap.DisplayOrder,
AttributeTypes.Description as Type,
AttributeTypes.XmlType,AttributeView.Length,Accuracy,IsCustomEntity,IsMappable,EntityView.IsCustomizable,EntityView.IsRenameable,IsActivity
FROM    LocalizedLabelView AS LocalizedLabelView_2
INNER JOIN       AttributeView
ON LocalizedLabelView_2.ObjectId = AttributeView.AttributeId
RIGHT OUTER JOIN       EntityView
INNER JOIN       LocalizedLabelView AS LocalizedLabelView_1 ON EntityView.EntityId = LocalizedLabelView_1.ObjectId
ON       AttributeView.EntityId = EntityView.EntityId
INNER JOIN attributetypes on AttributeView.AttributeTypeId = AttributeTypes.AttributeTypeId
INNER JOIN StringMap on StringMap.ObjectTypeCode = EntityView.ObjectTypeCode and StringMap.AttributeName = AttributeView.Name
WHERE   LocalizedLabelView_1.ObjectColumnName = ‘LocalizedName’ AND LocalizedLabelView_2.ObjectColumnName = ‘DisplayName’
AND LocalizedLabelView_1.LanguageId = ‘1033’ AND LocalizedLabelView_2.LanguageId = ‘1033’
AND AttributeTypes.Description in(‘picklist’,’state’,’status’)
ORDER BY EntityDisplayName, AttributeName

Advertisements
This entry was posted in Helpers, SQL and tagged , , , , . Bookmark the permalink.

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