Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

CRM365 on premises - I want to insert Industry type for few accounts whose name content specific word using sql

(0) ShareShare
ReportReport
Posted on by 15

I created entity called industry as each account types are more than one.

Few accounts name contain specific word e.g. Finance. I want to insert industry type Finance using SQL query.

Three tables (1) AccountBase- Accountid, Name (2) Industry - Industryid, name (3) new_Account_Insdutry - accounted, industryid.

I need sql query to insert rows in to new_account_industry  table those raws who met with where condition.

*This post is locked for comments

  • Suggested answer
    Nick.Doelman Profile Picture
    1,947 Most Valuable Professional on at
    RE: CRM365 on premises - I want to insert Industry type for few accounts whose name content specific word using sql

    This is unsupported and while you can run some basic SQL queries against CRM data, this is more dangerous because it will create records and things like GUIDs, links may not be properly created.

    From what I understand, you want to create N:N links.  Tools already mentioned in this thread would be good options.

    A tool I have used in the past is the in the XrmToolBox (A MUST HAVE for using Dynamics CRM).

    The particular tool is the "Manage-NN-relationships", details here:

    github.com/.../Manage-NN-relationships

    You can then setup a file to update your relationships (Account to Industry) and it will update in a supported, clean manner.

    Hope this helps.

    Cheers

    Nick

  • MKapde Profile Picture
    15 on at
    RE: CRM365 on premises - I want to insert Industry type for few accounts whose name content specific word using sql

    Thanks Aric.

  • MKapde Profile Picture
    15 on at
    RE: CRM365 on premises - I want to insert Industry type for few accounts whose name content specific word using sql

    Mahender,

    Thanks for reply. I am using scribe. Could you please elaborate more how can I use with scribe.

  • MKapde Profile Picture
    15 on at
    RE: CRM365 on premises - I want to insert Industry type for few accounts whose name content specific word using sql

    Hi Ravi,

    Thanks for the reply.

    My challenge is bit different then simple data import.

    Goal: Search Accounts name content word 'Finance', Add industry type 'Finance' if it's not there.

    (1) My all Accounts already have their industry types.

    (2) I want to search all Accounts name content word 'Finance'.

    (3) Search those accounts in many-to-many relationship table. Who do not have industry type 'Finance'

    (4) Insert records for only those accounts. I don't want duplicates industry types on account.

    Do you have any suggestions to accomplish above ?? then please guide me.

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at
    RE: CRM365 on premises - I want to insert Industry type for few accounts whose name content specific word using sql

    Hi,

    As mentioned above, it is unsupported and may cause some other unknown issues. Why are you looking only for SQl query?  As this seems pretty straight forward insert, you could download the excel data template for Industry entity, populate it withj the required data values and then import it back in CRM.

    You can refer the below video on excel data import (though it is for 2011 but still valid)

    www.youtube.com/watch

    Hope this helps.

  • Suggested answer
    Mahendar Pal Profile Picture
    45,095 on at
    RE: CRM365 on premises - I want to insert Industry type for few accounts whose name content specific word using sql

    Hi,

    Technically it's possible, but you need to be very careful as it can lead to data inconsistency and off course as said earlier this is totally unsupported, so it will be better to consider other options like import export/ondemand workflow (if you can query specific accounts) or custom tools like SSIS toolkit or scribe.

  • Suggested answer
    Aric Levin - MVP Profile Picture
    30,188 Moderator on at
    RE: CRM365 on premises - I want to insert Industry type for few accounts whose name content specific word using sql

    This is unsupported.

    You should only insert data using the SDK/Web Api/Data Import Tool or something other method that connects to CRM directly.

    SQL should basically used to read data using FilteredViews (and possibly some performance enhancements where necessary), but not for manipulating the data.

    Hope this helps.

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
dkrishna Profile Picture

dkrishna 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans