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 / Connect to SQL database
Power Automate
Answered

Connect to SQL database

(0) ShareShare
ReportReport
Posted on by 23

I am trying to connect SQL database with my flow. I am performing operations on the table view. I am able to perform insert operation successfully but in case of update I am getting error "The specified table has no primary key. Update and delete operations are not supported." I have dully checked for the Primary key, it is defined in the table. My PK was set on auto increment. I tried to create a PK without auto increment in another table and created another view and new flow but still for update I got same error.

Kindly help.

Categories:
I have the same question (0)
  • Pstork1 Profile Picture
    69,246 Most Valuable Professional on at

    Can you show us the definition of the Primary Key column in SQL?  That's usually the issue if you can't update items in SQL.  Also, do you have any SQL triggers defined on the table?

  • ntripathi Profile Picture
    23 on at

    No I do not have any trigger in the SQL Table.

     

    Below is the Primary key and Foreign Key schema:

     

    [ColumnName] [int] IDENTITY(1,1) NOT NULL

     

    CONSTRAINT [PK_keyName] PRIMARY KEY CLUSTERED

    ([ColumnName] ASC)

    WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

    ) ON [PRIMARY]

     

    ALTER TABLE [Table1] WITH CHECK ADD CONSTRAINT [FK_FKName] FOREIGN KEY([table2Column]) REFERENCES [Table2] ([table2Column])

    ALTER TABLE [Table1] CHECK CONSTRAINT [FK_FKName]

     

  • v-alzhan-msft Profile Picture
    Microsoft Employee on at

    Hi @ntripathi ,

     

    Could you please share the screenshot of the configuration of the flow?

    Could you please share the run history of the flow when it has run failed?

     

    Best Regards,

    Alice

     

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

     

     

  • ntripathi Profile Picture
    23 on at

    @v-alzhan-msft  Kindly find the error screenshot attached.

     

    It is a simple flow that has one insert and one update statement.error.png

     

    Thanks.

  • v-alzhan-msft Profile Picture
    Microsoft Employee on at

    Hi  @ntripathi ,

     

    Please share the screenshot of the configuration of the flow.

     

    Best Regards,

    Alice

     

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

  • ntripathi Profile Picture
    23 on at

    Hi @v-alzhan-msft ,

     

    Attached flow config. flow.png

  • ntripathi Profile Picture
    23 on at

    Hi @v-alzhan-msft ,

     

    also find the below Update query from flow :

     


    {
        "inputs": {
            "host": {
                "connectionName": "shared_sql_1",
                "operationId": "PatchItem_V2",
                "apiId": "/providers/Microsoft.PowerApps/apis/shared_sql"
            },
            "parameters": {
                "server": "ServerName",
                "database": "DBName",
                "table": "ViewName",
                "id": "@triggerOutputs()?['body/ID']",
                "item/Created_x0020_by": "@triggerOutputs()?['body/Author/DisplayName']",
                "item/Modified_x0020_by": "@triggerOutputs()?['body/Editor/DisplayName']",
                "item/Col1": "@triggerOutputs()?['body/Col1']",
                "item/Col2": "@triggerOutputs()?['body/Col2']",
                "item/Col3": "@triggerOutputs()?['body/Col3']"
            },
            "authentication": "@parameters('$authentication')"
        }
    }

  • v-alzhan-msft Profile Picture
    Microsoft Employee on at

    Hi @ntripathi ,

     

    You need to know the special row id when update the row in the table, and you should choose the table from the drop down list instead of enter the name manually.

     

    Best Regards,

    Alice

     

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

  • ntripathi Profile Picture
    23 on at

    Hello @v-alzhan-msft ,

     

    I need to perform operations on a table view. The view name does not appear automatically in the dropdown. So I provide the custom value for the column. And then it populates the view columns in the flow action.

     

    Please let me know if there should be other way of doing above

     

    Thanks.

  • Verified answer
    v-alzhan-msft Profile Picture
    Microsoft Employee on at

    Hi @ntripathi

     

    Sorry for I'm afraid that the requirement couldn't be achieved in Microsoft flow currently, as I have mentioned above, you need to know the table name and the unique id of the row when use the Update row action.

     

    Best Regards,

    Alice

     

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

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 573

#2
Valantis Profile Picture

Valantis 407

#3
11manish Profile Picture

11manish 387

Last 30 days Overall leaderboard