You've already forked ssms-addin
mirror of
https://github.com/alex-bochkov/ssms-addin.git
synced 2025-11-23 22:04:53 +02:00
Update mark identity NOT FOR REPLICATION.sql
This commit is contained in:
@@ -2,3 +2,22 @@ EXEC sp_msforeachtable @command1 = '
|
||||
declare @int int
|
||||
set @int =object_id("?")
|
||||
EXEC sys.sp_identitycolumnforreplication @int, 1'
|
||||
|
||||
|
||||
|
||||
--smarter way to do it
|
||||
SELECT
|
||||
s.name AS schemaName,
|
||||
o.name AS tableName,
|
||||
ic.name AS columnName,
|
||||
'declare @int int
|
||||
set @int =object_id(''[' + s.name + '].[' + o.name + ']'')
|
||||
EXEC sys.sp_identitycolumnforreplication @int, 1;
|
||||
GO' AS command
|
||||
FROM sys.identity_columns ic
|
||||
INNER JOIN sys.tables o
|
||||
ON ic.object_id = o.object_id
|
||||
INNER JOIN sys.schemas s
|
||||
ON o.schema_id = s.schema_id
|
||||
WHERE ic.is_not_for_replication = 0
|
||||
AND o.is_ms_shipped = 0
|
||||
|
||||
Reference in New Issue
Block a user