Home Forums SQL Server 7,2000 Administration How to check "not for replication" status using T-SQL or GUI in SQL 2000 RE: How to check "not for replication" status using T-SQL or GUI in SQL 2000

  • I have been currently using the following script to check if the identity column in my tables exist, and if so, is not for replication.

    hope it helps

    marcelo

    SELECT OBJECT_SCHEMA_NAME(p.object_id) AS [Schema]

    , OBJECT_NAME(p.object_id) AS [Table]

    , i.name AS [Index]

    , p.partition_number

    , p.rows AS [Row Count]

    , i.type_desc AS [Index Type]

    ,K.increment_value as IncrementValue

    ,K.last_value as LastValue

    ,K.seed_value as SeedValue

    ,k.is_nullable

    ,k.is_identity

    ,k.is_filestream

    ,k.is_replicated

    ,k.is_not_for_replication

    FROM sys.partitions p

    INNER JOIN sys.indexes i

    ON p.object_id = i.object_id

    AND p.index_id = i.index_id

    INNER JOIN SYS.TABLES S

    ON S.object_id = P.object_id

    LEFT OUTER JOIN sys.identity_columns K

    ON P.object_id = K.object_id

    WHERE i.index_id < 2 -- GET ONLY THE CLUSTERED INDEXES - IF EXISTS ANY

    ORDER BY [Schema], [Table], [Index]