Tuesday, June 28, 2016

Rename a table involved in replication from publication without re-initialization

EXEC  sys.sp_dropsubscription 

    @publication = N'ABC_pub',

    @article = N'Candidate',

    @subscriber = N'SQl4',

    @destination_db = N'ABC' ;

GO


EXEC sys.sp_droparticle 

    @publication = N'ABC_pub',

    @article = N'Candidate',

    @force_invalidate_snapshot = 1 ;

GO


 

 Use ABC

 go

 sp_rename 'Candidate','Candidate_X';


 --back to original 

 Use ABC

 go

 sp_rename 'Candidate_X','Candidate';


 

No comments:

Post a Comment

https://blog.sqlauthority.com/2009/06/27/sql-server-fix-error-17892-logon-failed-for-login-due-to-trigger-execution-changed-database-context...