Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to drop table in replication?
Message
 
To
31/10/2007 09:08:56
General information
Forum:
Microsoft SQL Server
Category:
Replication
Environment versions
SQL Server:
SQL Server 2000
Miscellaneous
Thread ID:
01265087
Message ID:
01265339
Views:
7
This message has been marked as the solution to the initial question of the thread.
Samuel,

Both Stored procedures are integral part of standard SQL 2000/2005 install.

http://technet.microsoft.com/en-us/library/ms184385.aspx
http://technet.microsoft.com/en-us/library/ms173832.aspx


>Hi Zoran,
>
>Thanks for the instruction. Where do I get the two store procedures that you have mentioned below? Please advise.
>
>Thanks,
>Sam
>
>>>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
Reply
Map
View

Click here to load this message in the networking platform