I have established a transactional replication. I have realized the replication resets all identity values to NULL on the subscriber (backup). Sometimes I need to write to the subscriber database, then back it up and restore it in the publisher (primary). The issue is the identity values need to be identical between both databases.
How can I reset (RESEED) the identity values for lets say database ABC from database XYZ?
If I were to reset it without the need of the database XYZ, it would be something like this
USE [ABC];
EXEC sp_MSForEachTable '
IF OBJECTPROPERTY(object_id(''?''), ''TableHasIdentity'') = 1
DBCC CHECKIDENT (''?'', RESEED)'
GO