I am not able to modify the structure of a table in a database.
The database is used for replication.
I am getting This error
I am not able to modify the structure of a table in a database.
The database is used for replication.
I am getting This error
As the error says the table is used for replication, meaning it's an article in a replication publisher. To be able to modify the table you should remove it from replication, then update the schema, afterwards add it again in the replication. After adding it again you will have to reinitialize the subscriptions to pick up the modified table schema.
I was having this error on my replication
Cannot drop the table 'dbo.repl_application_camp_choice' because it is being used for replication. (Source: MSSQLServer, Error number: 3724)
the first thing I tried - wrongly - is to manually drop the table in the subscriber db.
But the same error was there.
the next thing I tried is this:
USE [ORCASTG]
GO
EXEC sp_msunmarkreplinfo 'dbo.repl_application_camp_choice'
--Msg 3724, Level 16, State 3, Line 5
--Cannot drop the table 'dbo.repl_application_camp_choice' because it is being used for replication.
but it did not work
then I tried this one:
USE [ORCASTG]
GO
DECLARE @subscriptionDB AS sysname
SET @subscriptionDB = N'ORCASTG'
USE master
EXEC sp_removedbreplication @subscriptionDB
GO
USE [ORCASTG]
GO
DROP TABLE IF EXISTS [dbo].[repl_application_camp_choice]
GO
and this did the trick
and after running the script above: