我需要一个可以在整个数据库中识别的列表
SET IDENTITY_INSERT ON
谢谢你,谢谢你的帮助。
答案 0 :(得分:0)
我认为你需要这个:
SELECT 'SET IDENTITY_INSERT ' +OBJECT_NAME(OBJECT_ID)+ ' ON'
FROM SYS.IDENTITY_COLUMNS
WHERE OBJECT_NAME(OBJECT_ID) not like 'sqlagent_%'
AND OBJECT_NAME(OBJECT_ID) not like 'queue_messages%'
编辑:
SELECT 'SET IDENTITY_INSERT ' +OBJECT_NAME(OBJECT_ID)+ ' ON;'+'SET IDENTITY_INSERT ' +OBJECT_NAME(OBJECT_ID)+ ' OFF;'
FROM SYS.IDENTITY_COLUMNS
WHERE OBJECT_NAME(OBJECT_ID) not like 'sqlagent_%'
AND OBJECT_NAME(OBJECT_ID) not like 'queue_messages%'