web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Column Mapping within SQL

(0) ShareShare
ReportReport
Posted on by

Hi all,

I am trying to get a list of the field names (as they exist on the form) and what database column name that relates to.  A little bit like the screen you get on advanced find when you are selecting the columns you require.

So far i have this

select TargetAttributeName, SourceAttributename,*
from [dbo].[ColumnMapping]
where targetEntityName = 'Contact'
and targetAttributeName like '%state%'

But it seems that i am getting lots of results - and i am thinking perhaps this isnt the correct table (this seems to be something to do with exports?).  Could someone point me in the correct direction for the right table.

Thanks in Advance.

Dan

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    BackToTheCrm Profile Picture
    on at

    Hello Dan,

    You can use the Metadata Document Generator tool from XrmToolbox (http://www.xrmtoolbox.com/)

    The Schema Name is the name of the field in the SQL DB.

  • Community Member Profile Picture
    on at

    Hi,

    I don't think I have the required access to the front end for an application like that.  I have access to a copy of the database used for reporting that I need to try to find that information from.

    Thanks anyway,

    Dan

  • Verified answer
    BackToTheCrm Profile Picture
    on at

    Dan,

    Use this SQL query :

    SELECT e.Name as EntityName
          ,a.Name as LogicalName
          ,a.PhysicalName
          ,ll.Label AS DisplayName
      FROM [dbo].EntityView e
    
        INNER JOIN [dbo].AttributeView a 
        on e.EntityId = a.EntityId
        AND a.TableColumnName IS NOT NULL
    
        INNER JOIN LocalizedLabelView ll
        ON ll.ObjectId = a.AttributeId
        AND ObjectColumnName = 'DisplayName'
        AND LanguageId = 1033 -- English
    
    ORDER BY e.name, a.Name


    If the database language is not English replace 1033 by the correct LCID.

  • Suggested answer
    Community Member Profile Picture
    on at

    That is absolutely perfect.  Thank you so much!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
AS-17030037-0 Profile Picture

AS-17030037-0 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans