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 / auto incrementing ID i...
Power Automate
Unanswered

auto incrementing ID in mysql table using flow

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hey,

 

This is how my table looks in workbench:

 

kerrykevin_2-1611124556336.png

My flow looks like this:

kerrykevin_3-1611124656026.png

 

 

I am trying to increment ID column (primary key) starting from 0 and then 1, 2 , 3 so on.

Every time this flow runs it has to get the old column ID ( for eg: 49)  and increment by 1 (49 +1 = 50) for the new entry.

Can you please tell me the formula or how to go about it.

 

Thank you.

 

 

 

 

Categories:
I have the same question (0)
  • v-litu-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous,

     

    You could set the ID field auto-increment, auto-increment allows a unique number to be generated automatically when a new record is inserted into a table.

    The following SQL statement defines the "Personid" column to be an auto-increment primary key field in the "Persons" table:

     
    CREATE TABLE Persons (
    Personid int NOT NULL AUTO_INCREMENT,
    LastName varchar(255) NOT NULL,
    FirstName varchar(255),
    Age int,
    PRIMARY KEY (Personid)
    );
     

    MySQL uses the AUTO_INCREMENT keyword to perform an auto-increment feature.

    By default, the starting value for AUTO_INCREMENT is 1, and it will increment by 1 for each new record.

    Your workaround is the only way could approach via Flow.

     

    Best Regards,
    Community Support Team _ Lin Tu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hey, 

    Thank you for the solution.

     

    I am facing a problem in the flow when i follow your solution.

     

    My flow looks like this after i have created using your Sql query:

     

    kerrykevin_0-1611724209598.png

     

    The ID has the asterixis, hence i have to manually type a formula.

     

    I have used add(outputs('To_Auto_increment_ID'),1).

     

    But it says : The table has NULL values and it expects it to have an interger to add 1.

    (I cleared all rows in my table before trying this).

     

     

    Thank you.

     

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 594

#2
Valantis Profile Picture

Valantis 469

#3
11manish Profile Picture

11manish 364

Last 30 days Overall leaderboard