Where does Microsoft Dynamics CRM store OptionSet values in SQL Server?

Here is an SQL Server function to query the stringmap

CREATE FUNCTION fn_new_GetStringMapValue 
(
    @AttributeName nvarchar(100),
    @AttributeValue int
)
RETURNS nvarchar(4000)
AS
BEGIN
    DECLARE @Result nvarchar(4000)
    SELECT @Result = Value
    FROM dbo.FilteredStringMap
    WHERE AttributeName = @AttributeName AND AttributeValue = @AttributeValue

    RETURN @Result
END
GO

Just a reminder! Use FilteredStringMap to continue to be 'supported' by Microsoft!


These are all stored in the StringMapBase table. You'll query via object type code of the entity, attribute name, option set value and language and that'll give you the display value of the attribute.