sp_rename conflicts with Replication

  • When replication is enabled for a table, and you try to

    sp_rename Table1,Table2

    this occurs:

    Server: Msg 15051, Level 11, State 1, Procedure sp_rename, Line 234

    Cannot rename the table because it is published for replication.

    Is there any way to tell if Replication is actively moving rows for this table (or any table), as opposed to merely enabled ?

    Would need to check this via a SQL or Transact-SQL query, not via Enterprise Manager.

    Alternatively, is there a way to let the table be renamed in the Publisher db ?

    Thanx.

  • If you have a table in a publication you won't be able to rename the table, unless you drop the publication, rename the table, and then recreate the publication.

    To know if the table is in any publication, execute SELECT article FROM Distribution.dbo.MSArticles WHERE Article = 'yourTable'

    from the distributor.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply