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 / Function Patch with Ta...
Power Apps
Answered

Function Patch with Table SQL Server with several fields form the primary key

(0) ShareShare
ReportReport
Posted on by 35

I have a table SQL Server that it has a several fields that form of primary key

When I use a patch function on a Gallery of this table to change the value of a field it happens an error. And if I use a Update function the Server say Register not found. But the same functions with a table with a primary key with a unique field work correct. I think the problem is tables with several fields as primary key.

It's correct that? There is any way to get that run correctly?

I add the design of table and sentence Patch function

Categories:
  • Verified answer
    timl Profile Picture
    37,350 Super User 2026 Season 2 on at

    Hi @jclaraf 

    Unfortunately, I think that there have always been issues with using tables with composite keys. This one dates back several years.

    https://powerusers.microsoft.com/t5/Building-Power-Apps/Getting-data-from-SQL-Server-table-with-composite-key/td-p/37774 

    I think the easiest thing to do is to create a single auto-incrementing, int (identity) column and to use that as your primary key.

    I understand that you want to enforce uniqueness across those multiple columns so to do that, you can define a unique index rather than use a composite PK.

    https://docs.microsoft.com/en-us/sql/relational-databases/indexes/create-unique-indexes?view=sql-server-ver15 

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @timl , This has been particularly useful as I was stuck when deciding to assign the type of keys be it Composite or create a brand new Primary Key within my junction table (references to two particular parent table). Now with the understanding that this is a limitation at this point in time with PowerApps - until at least there is a fix and demo surrounding this works nicely, I'll practice only assigning Primary Keys and other Foreign keys (of which is sourced in the parent table as Primary Key) instead of assigning the composite keys. Good stuff! 

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 Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 258

#3
Mohsin Ali Profile Picture

Mohsin Ali 231

Last 30 days Overall leaderboard