Home Forums SQL Server 7,2000 Replication Cannot drop the database XXX because it is being used for replication. RE: Cannot drop the database XXX because it is being used for replication.

  • what type of replication?

    What I've had to run to make sure my scripts are starting clean for merge replication are as follows:

    'Drop any subscriptions

    exec sp_dropmergesubscription @publication = N'<publication>''

    'Drop the publication

    exec sp_dropmergepublication @publication = N'<publication>'

    'Set the DB to not be for replication

    exe sp_replicationdboption @dbname= N'<db>' @optname=N'merge publish' @value = 'FALSE'

    If you're using trans rep I believe the commands are similar.

    Also if you go into EM and right-click the publication you can choose 'generate script' which will give you the option to see the script for creating or droping the publications.

    regards,

    Chris