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

前端 未结 7 1379
-上瘾入骨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:23

    I believe it needs to be done in a single query batch. Basically, the GO statements are breaking your commands into multiple batches and that is causing the issue. Change it to this:

    SET IDENTITY_INSERT tbl_content ON
    /* GO */
    
    ...insert command...
    
    SET IDENTITY_INSERT tbl_content OFF
    GO
    

提交回复
热议问题