Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to drop table in replication?
Message
 
À
30/10/2007 12:44:11
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Réplication
Versions des environnements
SQL Server:
SQL Server 2000
Divers
Thread ID:
01265087
Message ID:
01265291
Vues:
7
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform