SQL get attributes details of entities

The following SQL can be used to retrieve information and details about all attributes in an entity.

SELECT  EntityView.Name AS EntityName, LocalizedLabelView_1.Label AS EntityDisplayName,
AttributeView.Name AS AttributeName, LocalizedLabelView_2.Label AS AttributeDisplayName,AttributeTypes.Description as Type,
AttributeTypes.XmlType,AttributeView.Length,AttributeView.MaxLength,AttributeView.AttributeRequiredLevelId,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
WHERE   LocalizedLabelView_1.ObjectColumnName = ‘LocalizedName’ AND LocalizedLabelView_2.ObjectColumnName = ‘DisplayName’
AND LocalizedLabelView_1.LanguageId = ‘1033’ AND LocalizedLabelView_2.LanguageId = ‘1033’
ORDER BY EntityDisplayName, AttributeName

Advertisements
This entry was posted in Helpers, SQL. 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