Technical Article

SQL 2005 - List value of 'Not For Replication'

,

DBA's always face problem with Indentiy columns in replications. Following scripts will list all identity columns in current database with the value of 'Not For Replication'.

SELECT OBJECT_NAME(OBJECT_ID) AS TABLENAME, 
 c.Name as COLUMNNAME,
 CASE IS_NOT_FOR_REPLICATION 
  WHEN 1 THEN 'YES'
  ELSE 'NO' 
 END as 'NotForReplication'
FROM SYS.IDENTITY_COLUMNS c JOIN sysobjects so (NOLOCK) ON so.id = c.OBJECT_ID
WHERE OBJECT_NAME(OBJECT_ID) not in ('dtproperties')
 and OBJECT_NAME(OBJECT_ID) not like ('MSMerg%')
and OBJECT_NAME(OBJECT_ID) not like ('SysMerg%')
and so.type = 'u'
ORDER BY 1

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating