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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Maintain Existing rela...
Power Apps
Suggested Answer

Maintain Existing relationship between SQL tables when added as Virtual Tables to Dataverse

(0) ShareShare
ReportReport
Posted on by
I have two tables joined in SQL SERVER as an example I have a projects table that is constructed like this 
 
CREATE TABLE [dbo].[Projects](
    [ID] [int] IDENTITY(1,1) NOT NULL,
    [Name] [nvarchar](100) NOT NULL,
    [Manager] [nvarchar](100) NULL,
    [StartDate] [date] NULL,
    [EndDate] [date] NULL,
PRIMARY KEY CLUSTERED 
(
    [ID] ASC
)WITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
 
 
and a tasks table like this 
 
CREATE TABLE [dbo].[Tasks](
    [ID] [int] IDENTITY(1,1) NOT NULL,
    [ProjectID] [int] NOT NULL,
    [TaskName] [nvarchar](255) NOT NULL,
    [AssignedTo] [nvarchar](100) NULL,
    [StartDate] [date] NULL,
    [DueDate] [date] NULL,
    [Comments] [nvarchar](max) NULL,
PRIMARY KEY CLUSTERED 
(
    [ID] ASC
)WITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
ALTER TABLE [dbo].[Tasks]  WITH CHECK ADD  CONSTRAINT [FK_Project_Tasks] FOREIGN KEY([ProjectID])
REFERENCES [dbo].[Projects] ([ID])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[Tasks] CHECK CONSTRAINT [FK_Project_Tasks]
GO
 
 
When I add the tables to dataverse as virtual tables I added the project table with a primary key fields as ID and Tasks table with primary key field as ID. If I use the native sql tables to build the many(tasks) -> 1 (Projects) and use the ProjectID field as the external Name field I get an error that the field entity is already in used by another entity. 
 
I tried following this blog https://community.powerplatform.com/forums/thread/details/?threadid=62d050e2-e6a2-f011-bbd3-000d3a110039 and create views that create text verisons of my primary key columns.  When I created the relationship I ran into an error that the string view id fields need to be able to be parsed as a GUID. When I updated my views to turn in ids into 32 string guids with 4 dashes I was able to get the relationship to hold true. However, then my tables become un editable within the dataverse environment and I get insert errors. 
 
Has anyone been able to add related sql server tables to dataverse as virtual tables, recreate the same relationship and maintain the ability to edit the table records????
I have the same question (0)
  • Suggested answer
    stampcoin Profile Picture
    5,171 Super User 2026 Season 1 on at
     
    Did you update the table forms/views which should include the lookup columns and other required columns ?
    If not, please make sure those included.
     

    Enjoy Power Platform and have a great day 🚀 |  My LinkedIn

    If the answer helps, please consider 👍, Thanks.

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 424

#2
WarrenBelz Profile Picture

WarrenBelz 355 Most Valuable Professional

#3
11manish Profile Picture

11manish 290

Last 30 days Overall leaderboard