set identity_insert on off 失效 不起作用

set identity_insert on off 失效

明明设置了set identity_insert on

但SQL就是提示 set identity_insert off,导致无法手动指定autoid的自增列数值。

网上有很多例子了,但是我这种特殊情况,并非使用上的问题,而是SQL BUG导致的,网上搜寻了半天没找到原因,后来去翻查了微软SQL网站两个多小时,终于找到原因,特别分享出来,以免其他用户踩坑。

贴出问题:

在这里插入图片描述

这是微软官方bug导致,补丁修补说明:
https://support.microsoft.com/zh-cn/help/4537347/kb4537347-fix-error-544-occurs-when-you-use-set-identity-insert-on-tem

解决方案:
https://www.catalog.update.microsoft.com/Search.aspx?q=sql%20server%202019

去上方下载微软SQL最新的GDR补丁与最新的累计更新SU补丁解决,其中SU补丁必须打,因为这个bug修复是在SU补丁中修复的,注意的是,一旦从GDR转移到SU补丁线路,后续的补丁更新必须走SU线路,不可转回GDR线路,请注意。(我先打GDR补丁重启系统后打SU补丁解决问题。)