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 Automate / SQL connector howto ob...
Power Automate
Unanswered

SQL connector howto obtain Row Id

(1) ShareShare
ReportReport
Posted on by 401

I noticed that the SQL connector actions Get Row, Update Row and Delete Row all require a so called Row ID.

So rather than to use a key field in the table, we seem obliged to use this Row ID instead.

 

I've been looking at what is returned by Get Rows to see if the Row ID was part of this but it does not seem the case.

 

{
 "@odata.context": "https://flow-apim-europe-001-francecentral-01.azure-apim.net/apim/sql/0cc11648080d441ead1904e034b305bb/$metadata#datasets('default')/tables('%5Bdbo%5D.%5BMH_SAPdata_updates%5D')/items",
 "value": [
 {
 "@odata.etag": "",
 "ItemInternalId": "895216ba-649a-4913-a7cb-df35bf891400",
 "Sales_x0020_Document": "121029 ",
 "Comment": "<div class=\"ExternalClass412470A3E48343ABA10351B566D26833\"><p>?Where?<br></p><p>When????<br></p><p>Who?<br></p></div>",
 "Reason": "How?"
 }
 ]
}

I wonder what to make of the 'ItemInternalId', but I have also no idea how to obtain that.

I've tried something like: body('Get_rows')['ItemInternalId'] but it either returns nothing or flow whines it doesn't exist.

 

Can anyone explain how to use these connectors if one doesn't know the Row ID's, because for now I don't believe there is. To me it seems the trick with the Row ID renders these SQL connection actions completely useless.

 

Meanwhile I find this and I'm trying to make sense of it but I fail again.

table_with_PK.jpg

If I understand the limitations correctly, the table requires to have a primary key, so the RowID would be the Sales Document since this is the primary key.

 

 

 

I'm re-running my failed flows,... and today it all works. Completely flabbergasted!

 

 

 

So the bottom line, the RowID is in fact the primary key defined on your table.

 

Sorry for my previous rant but I now just keep my fingers crossed that it continues to work.  🙂

 

 

Thanks for any feedback

 

Michel

Categories:
  • v-yamao-msft Profile Picture
    Microsoft Employee on at

    Hi @MichelH,

     

    Thanks for sharing and updating. I am so glad that it is working for you now.

    Yes, the Row Id is the primary key that we defined on the table.

    Let’s say that you have two SQL tables, one has a Primary key, another not.

    In the SQL action Get rows, you could select both tables. However, in action Update row which is asking a value for Row id, you won’t be able to select the table that doesn’t have a Primary key field.

    1.PNG

     

    Best regards,

    Mabel

  • GabrielStJohn Profile Picture
    Microsoft Employee on at

    Hello, @MichelH!

    Thank you for posting on the Flow Community Forum! Have you had an opportunity to apply @v-yamao-msft‘s recommendation to adapt your Flow? If yes, and you find that solution to be satisfactory, please go ahead and click “Accept as Solution” so that this thread will be marked for other users to easily identify!

    Thank you for being an active member of the Flow Community!

    -Gabriel
    Flow Community Manager

  • MichaelFriesen Profile Picture
    6 on at

    Thanks for the clarification! 

     

    For tables with composite keys though, how do the SQL Update/Delete row blocks work?

     

    I have a number of link tables where there are two or three ID columns making up the composite key instead of having a separate primary key.  

     

    Thanks for any insight,

    Michael

  • Jsamano Profile Picture
    6 on at

    This is a very valuable question. Im facing same issue right now. How did you work it out @MichaelFriesen?

     

    Thanks.

     

    *Edited*

    Later I found this solution , as simple as using coma separator.

  • MichaelFriesen Profile Picture
    6 on at

    Hey @Jsamano,

     

    In the end I used the SQL Execute Stored Procedure (v2) blocks and wrote custom stored procedures that could handle the composite keys.  Unless there's an update as to how the RowID is defined with the SQL CRUD blocks, I think that's the only way that will work.

    Hope that helps,
    Mike

  • JohanResen Profile Picture
    9 on at

    Hi Michael

     

    It seems you have solved it by using stored procedures but I figured out that if your table has a primary key consisting of two or more columns, the SQL Server connector can still handle it by writing the column values in a comma-separated format. I.e. the primary key is defined as RowKey and PartitionKey on the table in SQL, then the value for Row ID is Rowkey, PartitionKey in Logic Apps. In the attached image, I reference a previous Get Rows step, but you can type the value directly (i.e. 1000, 'Partition no 1').

    JohanResen_1-1631616971651.png

     

     

     

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 Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 414

#2
11manish Profile Picture

11manish 335 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 274

Last 30 days Overall leaderboard