Thursday, September 27, 2012

How to get the OptionSet attributes and values from SM CRM 2011 , by SQL query

the below is the query to get OptionSets and the Values from the whole organization of MS CRM 2011 DB.


SELECT DISTINCT sm.attributeName, e.name, SM.Value AS Option_Value
FROM   StringMap AS SM INNER JOIN
       MetadataSchema.Entity AS E ON E.ObjectTypeCode = SM.ObjectTypeCode
--and e.name like 'new_%' – can use this if you want only the Custom Attributes
order by 1,2,3

result will be like as follows...


accessmode     SystemUser     Administrative
accessmode     SystemUser     Non-interactive
accessmode     SystemUser     Read
accessmode     SystemUser     Read-Write
accessmode     SystemUser     Support User
accountcategorycode  Account          Preferred Customer
accountcategorycode  Account          Standard

 
Regards,
yes.sudhanshu

No comments:

Post a Comment