Search code examples
sqldynamics-crmmicrosoft-dynamicsdynamics-365

Dynamic 365 : SQL query to retrieve all picklist values and text


On my Dynamics 365 i have a long picklist attribute in my Account(contact) entity. Attribute name called new_nationality (196 values).

How do i write the SQL query to retrieve those all values from CRM Sql Db?


Solution

  • I have gone through the CRM Db and i found the table. find my query which i used which i used to retrieve given below.

    SELECT  Value as 'Label', AttributeValue as 'Value'
    FROM StringMap s
    JOIN EntityLogicalView e on s.ObjectTypeCode = e.ObjectTypeCode 
    WHERE  s.LangId = 1033 and AttributeName = 'new_nationality' and LogicalName = 'account'
    order by AttributeValue 
    

    enter image description here