>I am trying to drop this table, but I keep getting this error. How do I delete this table? Please help.
>
>
>if exists (select * from dbo.sysobjects where id = object_id(N'[my_table_name]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
>drop table [my_table_name]
>GO
>
>Server: Msg 3724, Level 16, State 2, Line 2
>Cannot drop the table 'my_table_name' because it is being used for replication.
>
>
>Thanks,
>Sam
Samuel,
You have to remove it from the publication first!
Please find example below:
exec sp_dropsubscription
@publication = N'MyPublication',
@article = N'MyTableName',
@subscriber = N'all',
@destination_db = N'all'
GO
exec sp_droparticle
@publication = N'MyPublication',
@article = N'MyTableName',
@force_invalidate_snapshot = 1
GO
-- AND NOW YOU CAN DROP THE TABLE !
DROP TABLE MyTableName
GO
--hope this helps
--Cheers