cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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!)

 

4 REPLIES 4
Highlighted
Helper V
Helper V

Re: SQL Delete Record RecordID for composite primary key

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

Smartmeter.

 

 

Highlighted
Community Support
Community Support

Re: SQL Delete Record RecordID for composite primary key

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.
https://powerusers.microsoft.com/t5/Flow-Ideas/idb-p/FlowIdeas

 

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.
Highlighted
Frequent Visitor

Re: SQL Delete Record RecordID for composite primary key

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

 
Highlighted
Helper V
Helper V

Re: SQL Delete Record RecordID for composite primary key

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

Helpful resources

Announcements
firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

Join the new Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Top Kudoed Authors
Users online (11,528)