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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Mimicing Salesforce Upsert using SQL

(0) ShareShare
ReportReport
Posted on by 1,290

Can anyone tell me how I can mimic the Salesforce Upsert process?  I can import data into MSCRM just fine but now I will need a good way to do an update of already existing records.  I'm quite SQL savy and I wondered if that was not a bad idea to do via SQL.  For example, lets say I want to update EmailAddress1:

Update
  dbo.ContactBase
Set
  EmailAddress1 = b.email
From
  dbo.ContactBase a
    inner join custom_db.dbo.MyTableOfeMail b
      on a.ContactId = b.ContactId

Where MyTableofemail is the table I prepared with the correct ContactID and the column 'email' is the email I want to update to.  I have been told it's not a good idea to update MSCRM via SQL but I would think this is safe enough.  Does anyone out there do this sort of thing?

Thanks,
Joe

*This post is locked for comments

I have the same question (0)
  • Mohammad Atif Profile Picture
    on at

    Hi Joe,

    Thank you for asking this question. I would say not to update any data in CRM database directly and suggest you to run this query only if you have a full backup of the CRM database so that if required you may restore your CRM database any time.

    The best way I would suggest you to restore the database with some other name and import the org selecting the newly restored database and then you can play with the database because and run the update queries you want to run.

    Thanks,

    Mohammad

  • Joe Spitler Profile Picture
    1,290 on at

    Really?  We need to update this databse quarterly.  There is no out of the box solution for updating a database?  I can't be the first user to asked this question?

  • Mohammad Atif Profile Picture
    on at

    Hi Joe,

    Thank you for reply.

    Could you please let me know how you are trying to reflect this change back to the CRM application after running this query in CRM database?

    Running any update or delete query directly into the CRM database is not recommended because we never know what all the references are there. So my initial response was to keep your database safe before running any update query directly into that.

    When you are asking any OOF solution for updating the database, are you looking for a solution or CRM tool that can do these changes directly into the CRM database and then link to those changes back to CRM application? If so there is no direct way which I am aware of linking any updated information form CRM database to application.

    Thanks,

    Mohammad

  • Joe Spitler Profile Picture
    1,290 on at

    So far I have only run update queries.  To update columns, for example, in the tables ContactExtensionBase and AccountExtensionBase.  I don't plan on doing any inserts or deletes via SQL but I didn't see any other way to do the update I needed.  It seems to have worked just fine.  If this not recommended then MS CRM is not a good solution for us.  I will need to update thousands of rows of data quarterly.  I'm quite surprised there isn't a function out of the box that allows this.  I was hoping to migrate away from Salesforce.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans