IDENTITY_INSERT is set to OFF - How to turn it ON?

前端 未结 7 1357
-上瘾入骨i
-上瘾入骨i 2020-12-12 18:05

I have a deleted file archive database that stores the ID of the file that was deleted, I want the admin to be able to restore the file (as well as the same ID for linking

相关标签:
7条回答
  • 2020-12-12 18:34

    Should you instead be setting the identity insert to on within the stored procedure? It looks like you're setting it to on only when changing the stored procedure, not when actually calling it. Try:

    ALTER procedure [dbo].[spInsertDeletedIntoTBLContent]
    @ContentID int, 
    
    SET IDENTITY_INSERT tbl_content ON
    
    ...insert command...
    
    SET IDENTITY_INSERT tbl_content OFF
    GO
    
    0 讨论(0)
提交回复
热议问题