Showing results for 
Search instead for 
Did you mean: 
Helper V
Helper V

SQL Delete Record RecordID for composite primary key

Quick question to my friends in the flow forum, I ended up making a stored procedure to lifecycle some SQL data that needed to be overlayed with an insert or delete insert scheme, to insure no duplicates are in the table on insertion. I used a stored proc to do a classic clean before insert, since the two step flow I had envisioned would not work. I used the SQL delete record, then insert record and they work fine, however, there is a pesky artifact of the RecordID that I may be ignorant to using. My key is two fields, a date and a small text record type. The RecordId can certainly contain two fields from the dynamic content picker, however it always errors out with some message that "the key contains two values and you only supplied one" So...I tried every delimiter I could come up with, checked google, and am left to believe that with SQL delete flow step, the simple primary key is the only supported paradigm. Can this "dynamic content" express a two field primary key, or am I pushing the limits? Either way, Thankyou Microsoft for letting me run a stored procedure from Flow so I could do my own data manips from my world !!!!!

PS - I absolutely LOVE being able to select a flow execution instance, then hopping through the steps to see not only what data I passed, but what the execution status was at each point in the decision tree. It's like a case statement that is in debug with visual studio after the run is over! (Wow, for as much as we developers complain, you guys are smart!)


Helper V
Helper V

OK, replying to myself is frankly creepy, but I will do it to document this for my silent friends in the land of flow.


I solved this by enhancing the stored procedure and passing the duplicate key fields into the SQL. From there I wipe the old stuff and delete the new stuff, effectively passing on the clustered primary key construct to the sql to deal with it. 


To the powers at Microsoft, if a primary key in SQL server can be multiple columns, we need a way in the flow tool to reference this, not just a single numeric ID for the key. I'm thinking this is an upcoming feature, but at this point I am talking to myself, so I will shut up!


So long, (and thanks for all the flows!)




Hi SmartMeter,


I am glad to hear that you have solved this issue.


Currently, Flow doesn’t support a primary key in SQL server with multiple columns, you may consider to submit an idea at Flow ideas Forum, I will help collect and report it on my side.


Best regards,
Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Not applicable

To delete rows with a composite primary key, just compose a string of the primary key columns each separated by a comma:


5-21-2020 11-40-41 AM.png


Thanks @Anonymous much appreciated! I will remember this next time I run into that two part key situation. Best wishes and stay healthy out there! 

@Anonymous I followed your suggestion but I got an error: Item with id '2020-09-01T10:00:00Z,Appraisals,20200901' does not exist.


Any ideas?




Helpful resources

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,374)