Red Gate forums :: View topic - Clear destination database before sync
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Compare 10
SQL Compare 10 forum

Clear destination database before sync

Search in SQL Compare 10 forum
Post new topic   Reply to topic
Jump to:  
Author Message
brian.chiu.rt



Joined: 07 May 2012
Posts: 2

PostPosted: Mon May 07, 2012 8:24 pm    Post subject: Clear destination database before sync Reply with quote

does anyone know if there's a way to clear the destination database before each sync?

I know this process might be a bit weird but what we're trying to do here is to create a schema backup for multiple databases by using redgate to sync with a staging DB before creating a backup of it.

thanks,
brian
Back to top
View user's profile Send private message
james.billings



Joined: 16 Jun 2010
Posts: 1144
Location: My desk.

PostPosted: Thu May 10, 2012 12:20 am    Post subject: Reply with quote

A standard sync will theoretically have the same effect (making the target DB match the source). This is the same as clearing down everything from the target then syncing. So I think I'm perhaps missing the point of what you're trying to do.

There's no option in SQL Compare to do this; but a workaround would be to have an empty database on your server, and first sync from this to the target (which should drop everything) then run your usual sync afterwards. But as I said above, the end result would be the same as the sync you're already doing.
Back to top
View user's profile Send private message
David Atkinson



Joined: 05 Dec 2005
Posts: 1124
Location: Twitter: @dtabase

PostPosted: Thu May 10, 2012 8:54 am    Post subject: Reply with quote

Are you running this as part of an automated process? If so, an alternative is to run the following:

sqlcmd -SYourServer -Q "ALTER DATABASE YourDB SET SINGLE_USER WITH ROLLBACK IMMEDIATE; DROP DATABASE YourDB"

sqlcmd -SYourServer -Q "CREATE DATABASE YourDB"

Can I ask why you're creating these schema backups? How will they be used?

David Atkinson
Product Manager
Red Gate
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group