25

I'm doing a data migration in to Microsoft Dynamics CRM 2011 and need to perform reconciliations against the source to ensure that everything loaded successfully.

To do this I am querying the SQL directly in SQL Server, but I can't seem to find where the OptionSet data is stored. Does anyone know what table(s) it's stored in?

Commander92
  • 418
  • 1
  • 4
  • 8

3 Answers3

31

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.

Matt
  • 4,656
  • 1
  • 22
  • 32
12

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

SarjanWebDev
  • 523
  • 3
  • 11
  • Has the FilteredStringMap table been replaced in newer versions? I am trying to retrieve perform a similar task in Dynamics Nav 2018 – Lindsay Dec 17 '19 at 05:54
7

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
Sandor
  • 1,839
  • 2
  • 18
  • 22
  • 4
    Modification of SQL database to add such functions is unsupported. If you are hosting this function that reads the FilteredStringMap from another database then it's supported. In the later case, you would use [ORGNAME_MSCRM].[dbo].[FilteredStringMap] – SarjanWebDev Apr 26 '13 at 06:12