Saturday, February 25, 2012

Restore a backup to a database using SQLDMO

Hai...
I am working on VC++. I need to restore the backup to the
database(SQL SERVER) using SQLDMO in VC++. I am able to restore the
backup only to the database where i taken the backup but to some other
database it fails. Can anyone provide me the solution for restoring the
backup to some other database? Looking for the reply...
Thanx in advance...
Regards,
PrinceYou need to set the Backup object ReplaceDatabase property to TRUE. From
the Books Online:
<Excerpt href="http://links.10026.com/?link=sqldmo.chm::/dmoref_p_r_1cop.htm">
If TRUE, a new image of the database is created. The image is created
regardless of the presence of an existing database with the same name.
If FALSE (default), a new image of the database is not created by the
restore operation. The database targeted by the restore operation must exist
on an instance of Microsoft SQL ServerT 2000.
</Excerpt>
Hope this helps.
Dan Guzman
SQL Server MVP
"Prince" <princevictor.moses@.gmail.com> wrote in message
news:1124188828.330558.78130@.z14g2000cwz.googlegroups.com...
> Hai...
> I am working on VC++. I need to restore the backup to the
> database(SQL SERVER) using SQLDMO in VC++. I am able to restore the
> backup only to the database where i taken the backup but to some other
> database it fails. Can anyone provide me the solution for restoring the
> backup to some other database? Looking for the reply...
> Thanx in advance...
> Regards,
> Prince
>

No comments:

Post a Comment