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.

  • Suggested answer
    D365Egg Profile Picture
    5 on at
    RE: SQL to Dynamics 365

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

  • Verified answer
    ChangeFrenzoId Profile Picture
    465 on at
    RE: SQL to Dynamics 365

    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

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,202 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,923 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans