[dba-SQLServer]SQL-DMO question

Arthur Fuller artful at rogers.com
Fri Mar 14 11:17:58 CST 2003


I have to provide a no-brainer solution to the following problem. The user
will receive a CD containing a backup of the network database, a snapshot of
some point in time. This backup must be restored to a new database, whose
names indicates the snapshot date. It's possible though unlikely that said
database already exists (i.e. dumb-ass user modified some data, changed his
mind, and now wants to restore the original). EM will not be installed, only
MSDE on (local). MSDE is guaranteed to be installed and running.

I'm looking at the sample SQL-DMO vb project called BackRestEvents, trying
to glean ideas from it. So far I have SQL-DMO code that successfully opens a
connection to (local) or any other available server. The vb sample app has
two problems: 

1. Unlike EM, it bitches when you type in a new database name. Within EM,
you can select any database, choose Restore, and enter a new database name,
resulting in a copy of some existing database. 

2. The code supplied doesn't deal with the possibility that the db already
exists. You get a message saying that you should use the "force restore"
argument(s) to achieve this. I'm new to the Restore object (and in fact to
this whole hierarchy). Can you tell me how to code these arguments to force
restore if the db exists?

Advice, URLs, etc. gratefully appreciated.

TIA,
Arthur




More information about the dba-SQLServer mailing list