HiveBrain v1.2.0
Get Started
← Back to all entries
debugsqlMinor

Cannot rename the table because it is published for replication

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
cannotthepublishedreplicationbecausefortablerename

Problem

I need to rename some tables in my DB - SQL Server 2005, with this:

EXEC sp_rename 'dbo.TableName', 'Tmp_TableName', 'OBJECT'


but I can't do this - I get this exception -


Cannot rename the table because it is published for replication

This DB doesn't have replication - it was removed 5 years ago - we've just tried it and removed it after a week. So I suppose that it should be a flag somewhere.

Please help me remove this flag somehow.

Solution

sp_removedbreplication 'DB_NAME' that will remove replication from the database.

From How to cleanup Replication Bits by Chris Skorlinski of Microsoft SQL Server Escalation Services:

sp_removedbreplication – Removes all replication objects from a database without updating data at the Distributor. This stored procedure is executed at the Publisher on the publication database or at the Subscriber, on the subscription database.

sp_removedbreplication is useful when restoring a replicated database that has no replication objects needing to be restored.

Context

StackExchange Database Administrators Q#47232, answer score: 9

Revisions (0)

No revisions yet.