I have two SQL Server connection strings, CX and CY.
What I need to do is
- Make sure there are no tables in CY.
- Backing up the CX database.
- Restore it to CY.
Didn't find what I'm looking for. I do not want the tool to do this, I need to do this in C # code at runtime, because the action of adding a new client needs to copy the main database to an empty database. I cannot use the pre-created script because I also need to copy the data, and the main database could be updated a few seconds before adding a new client.
=== UPDATE ===
I use Smo.Backup and Smo.Restore. When I try to recover, I get:
ERROR 3154 The backup set contains a backup of a database other than the existing database.
Can someone tell me how to get around this? In addition, I have a working solution!
thanks
Pete
source
share