> For the complete documentation index, see [llms.txt](https://docs.devolutions.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.devolutions.net/server/knowledge-base/troubleshooting-articles/cannot-rename-the-table-because-it-is-published-for-replication.md).

# Cannot rename the table because it is published for replication

Fixes a SQL replication error blocking a Devolutions Server workspace update by removing conflicting LogMessage tables before rerunning the update.

Updating a Devolutions Server workspace with SQL Server Replication enabled returns the following error message:

`Microsoft.Data.SqlClient.SqlException (0x80131904): Cannot rename the table because it is published for replication.`

### Solution

1. Run this SQL query and see if it returns 1038:

```sql
SELECT DatabaseVersion FROM dbo.DatabaseInfo
```

2. If it does return 1038, then run this query:

```sql
if   exists (select * FROM dbo.DatabaseInfo where DatabaseVersion = 1038)

 AND exists (SELECT  1 FROM sys.indexes i INNER JOIN sys.index_columns ic ON i.object_id = ic.object_id AND i.index_id = ic.index_id INNER JOIN sys.columns c ON ic.object_id = c.object_id AND ic.column_id = c.column_id WHERE i.object_id = OBJECT_ID(N'dbo.LogMessage') AND i.name = 'PK_LogMessage' AND c.name = 'ID' AND type_desc = 'CLUSTERED')

BEGIN

	drop table dbo.LogMessage;

END

GO

if   exists (select * FROM dbo.DatabaseInfo where DatabaseVersion = 1038)

 AND exists (SELECT  1 FROM sys.indexes i INNER JOIN sys.index_columns ic ON i.object_id = ic.object_id AND i.index_id = ic.index_id INNER JOIN sys.columns c ON ic.object_id = c.object_id AND ic.column_id = c.column_id WHERE i.object_id = OBJECT_ID(N'dbo.LogMessage_Archive') AND i.name = 'PK_LogMessage_Archive' AND c.name = 'ID' AND type_desc = 'CLUSTERED')

BEGIN

	drop table dbo.LogMessage_Archive;

END

GO
```

3. Start the workspace update once again.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.devolutions.net/server/knowledge-base/troubleshooting-articles/cannot-rename-the-table-because-it-is-published-for-replication.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
