Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to drop table in replication?
Message
 
To
30/10/2007 12:44:11
General information
Forum:
Microsoft SQL Server
Category:
Replication
Environment versions
SQL Server:
SQL Server 2000
Miscellaneous
Thread ID:
01265087
Message ID:
01265291
Views:
6
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform