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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Cannot Patch to SQL: I...
Power Apps
Suggested Answer

Cannot Patch to SQL: Invalid Arguments

(2) ShareShare
ReportReport
Posted on by 34
We have 2 SQL connections, one to fabric and other to normal SQL. I am trying to Patch to either, but they both don't work and both just say "Invalid Arguments" without specifying why, the error is different to one that has an invalid argument.

I have tried many variations and am using a Stored Procedure on the SQL as a backup, but this is extremely frustrating.
 
I rebuilt the connection and added it to a new blank canvas, same issues are occuring.
 
Monitor does not work as Power Apps is identifying an error and won't run the formula.
 
I believe there may be something wrong with my environment, as it is happening on both SQL servers with different tables.
 
Is there any sort of troubleshooting I can do to actually find WHY its failing?
 
ID is the only required collumn...
 
 
 
Here is every variation I have tried...
UpdateContext({varGUID: GUID(),varRecord:First(PIW_K10)});

// Blank record with only ID (UID column type)
Patch(PIW_K10,
    Defaults(PIW_K10),
    {
        ID: varGUID
    }
);

// Replacing a record with itself, record has to be valid as its stored.
Patch(
    PIW_K10,
    varRecord,
    varRecord
);


// Avoiding ID.
Patch(
    'PIW_K10',
    First('PIW_K10'),
    {
        Modified_On:Now()
    }
);

// Correctly Errors as ID is UID not int
Patch(
    'PIW_K10',
    Defaults('PIW_K10'),
    {
        ID: 123
    }
);

// Stored Proc works fine.
'PIW_WH%20'.dboManagePIWK10(
    {
        OperationType: "INSERT",
        ID: varGUID
    }
);
Categories:
I have the same question (0)
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,548 Super User 2025 Season 2 on at
    HI
     
    Is that a Table or a View?
    Does it have any Many to Many relationships?
     
    If so that's a known issue.
     
     
    Can you also try, go to the Data Tab, select your SQL Table Connection click the ... and select Edit
     
    Does it open the Table properly? If not thats it.
     
    Also, does your Table have a Primary key?
     
     
     
  • Borrid Profile Picture
    34 on at
    Thanks @FLMike,
     
    It's a Table. There are no Many to Many Relationships (It's the only table in our Fabric Lake).
     
    I cannot see any "Edit" in the connection, what could be the cause?

    (Ignore the second one, thats a view that joins two tables, I'm not using that to patch)

    "ID" is the Primary Key.
  • timl Profile Picture
    36,466 Super User 2025 Season 2 on at
    Hi @Borrid,
     
    To diagnose this further, I'd suggest that you add a Form control and attempt to edit/add a record by calling SubmitForm.
     
    If that works, that would verify that Power Apps is able to write to the table. 
     
    Another thing to check - is there a SQL trigger on the table? If so, that could be a possible reason because triggers are not supported. 
  • Suggested answer
    Borrid Profile Picture
    34 on at
    Thanks guys, I found the issue, the PK wasn't set properly but fixing that I got a 502 Error with the message 'OUTPUT is not supported' with no Query logs from the SQL server.
     
    If anyone could please confirm:

    it looks like Fabric Data WH tables might be incompatible with Power Apps as you can only create Primary Keys as NOT ENFORCED. https://learn.microsoft.com/en-us/fabric/data-warehouse/table-constraints

    Which I found someone having a similar issue in this thread although they're not 100% certain: https://community.powerplatform.com/forums/thread/details/?threadid=89581ea1-fe13-41ef-9539-f6c93367509f and the SQL connector does not mention ENFORCED being a requirement for a PK: https://learn.microsoft.com/en-us/connectors/sql/#general-known-issues-and-limitations
     
    So looks like we will just have to use the stored proc or switch to Dataverse, unless someone else has any other idea?

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 699 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 325 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 248

Last 30 days Overall leaderboard