Skip to main content

Notifications

Power Automate - Using Connectors
Answered

Insert Value into IDENTITY Column in SQL Server

(0) ShareShare
ReportReport
Posted on by 756

I have several tables in Azure SQL that have Identity Columns.  I am migrating data from another source that has an Id column. I want to retain the column definition of Identity for SQL but I want to insert the values from the source into that identity column. I have Set IDENTITY_INSERT to ON for the necessary tables. But when I try and setup the Flow using "Insert a row (v2)", it doesn't show the Identity column at all.

I tried recreating the table without IDENTITY, added the Insert into flow, which then showed the column, then dropped and created the table again with IDENTITY enabled.  Now flow still had the column I needed but when I executed the flow SQL returned the error IDENTITY_INSERT needs to be on, when it already was.

 

Any thoughts on how to do this? Dropping and recreating only works once, with the tables empty, any updates after that will not function.

 

Here is the exact error I am getting:

NOTE: IDENTITY_INSERT is ON for the table I am performing the insert on.

sperry1625_0-1644432861426.png

 

Thanks.

  • Verified answer
    sperry1625 Profile Picture
    sperry1625 756 on at
    Re: Insert Value into IDENTITY Column in SQL Server

    I resolved this by creating a Stored Procedure that turns the IDENTITY_INSERT ON/OFF as needed to perform the updates.

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,422

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,711

Leaderboard

Featured topics