Is it possible to change the name of the system table

I want to change the name of the system table in my database, is this possible? I probably shouldn't change it, but I'm curious.

When I execute sp_rename, I get the following error:

Msg 15001, Level 16, State 1, Procedure sp_rename, Line 404
Object 'cdc. [Dbo_CdcTest_CT] 'does not exist or is not a valid object for this operation.

Edit: I want to change the name of the tables created using Change Data Capture, because I want to disable the CDC mechanism for the table and still have the data - I know that I can create an additional table and transfer the data from the CDC table there, but it’s easier to change CDC name and then disable cdc for the specified table.

+3
source share
1 answer

No , you cannot change the name of the system tables. However, you can refer to it with a different name.

You can use synonyms for this:

CREATE SYNONYM [ schema_name_1. ] synonym_name FOR <object>

<object> :: =
{
    [ server_name.[ database_name ] . [ schema_name_2 ].| database_name . [ schema_name_2 ].| schema_name_2. ] object_name
}

It should also be mentioned that sp_rename

Changes the name of a user-created object in the current database.

This object can be a table, index, column, alias, or Microsoft.NET Framework standard runtime type.
+3
source

All Articles