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 365 | Integration, Dataverse...
Answered

SQL to Dynamics 365

(0) ShareShare
ReportReport
Posted on by 5

I have a few tables in SQL server which I would like to expose in Dynamics 365.

Here is an example of some tables.

-- Customer Table
CREATE TABLE dbo.Customers (
  ID INT IDENTITY(1,1) PRIMARY KEY,
  FirstName VARCHAR(10),
  LastName VARCHAR(10),
  DateOfBirth DATE
)

-- Customer Contact Number Table
CREATE TABLE dbo.ContactNumbers  (
  ID INT IDENTITY(1,1) PRIMARY KEY,
  CustomerID INT,
  NumberType VARCHAR(10),
  PhoneNumber VARCHAR(20)
 )

ALTER TABLE dbo.ContactNumbers    
ADD CONSTRAINT FK_ContactNumbers_CustomerID FOREIGN KEY (CustomerID)     
    REFERENCES dbo.Customers (ID)

-- Customer Address Table
CREATE TABLE dbo.CustomerAddress  (
  ID INT IDENTITY(1,1) PRIMARY KEY,
  CustomerID INT,
  AddressTypeType VARCHAR(10),
  AddressLine1 VARCHAR(50),
  AddressLine2 VARCHAR(50),
  AddressLine3 VARCHAR(50),
  AddressLine4 VARCHAR(50),
  Country VARCHAR(30)
 )

ALTER TABLE dbo.CustomerAddress   
ADD CONSTRAINT FK_CustomerAddress_CustomerID FOREIGN KEY (CustomerID)     
    REFERENCES dbo.Customers (ID) 

Just please be aware these are just example tables and I have many more with different names and for different purposes. I am not interested in using the pre-made entities which come with Dynamics.

I have also created three tables in PowerApp which match the tables shown above.

My understanding is there is no easy way to bulk import all this data at once and it will automatically map it. Is this correct?

My understanding is that you can't "join" tables together using specific columns (CustomerID in this example), and that I have to import the Customers table first which will create an internal guid on each customer, then use this guid when passing over the other tables (ContactNumbers, CustomerAddress)? I would be interested to know if that correct method.

I have the same question (0)
  • Verified answer
    ChangeFrenzoId Profile Picture
    465 on at

    You are absolutely correct. Existing join will not work here in CDS/Dataverse/power app. You have to use internal guid, which auto create on create or on import of the record.

    You can follow below process:

    • create all tables in CDS
    • Import data from SQL to CDS, ignore you sql join(relationship) for now
    • Complete your import for all the tables
    • Create relationships in CDS 
    • Use power automate or console, to set/link/join the records
  • Suggested answer
    D365Egg Profile Picture
    5 on at

    Excellent, I don't suppose you know a good tutorial or some examples for the last part you mention about linking them?

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 365 | Integration, Dataverse, and general topics

#1
iampranjal Profile Picture

iampranjal 47

#2
Martin Dráb Profile Picture

Martin Dráb 41 Most Valuable Professional

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 32 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans