Home All Groups Group Topic Archive Search About

SQLDMO:To Change Database file Location path of DBBackup file ( VC

Author
17 Dec 2005 11:44 AM
Inthi
Dear all
I am creating a tool in VC7.0 for database restoration
I am facing a problem while working with sql dmo objects i need to restore
a database, which has database location as "C:\Program Files\Microsoft SQL
Server\MSSQL\Data\Sample.mdf" to new instance of SQlserver called as
NEWINSTANCE.

If i try to restore the database file with out modifying the location path
then my restoration process is failing since "C:\Program Files\Microsoft SQL
Server\MSSQL\Data\" does not exist in the new machine.

So i need to change the database location file path as given below
"C:\Program Files\Microsoft SQL Server\MSSQL$NEWINSTANCE\Data\Sample.mdf"
but i am not able to figure out how to achive it
can any one please help me out to solve the problem

waiting in message loop for response message

With Regards

Author
17 Dec 2005 12:05 PM
Mike Epprecht (SQL MVP)
Hi

I don't have the SQL Server 2000 BOL on my machine at the moment, but the
T-SQL command will be "RESTORE DATABASE .......WITH MOVE"
AFAIK, there is an equivalent in DMO.

Regards
--------------------------------
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland

IM: m***@epprecht.net

MVP Program: http://www.microsoft.com/mvp

Blog: http://www.msmvps.com/epprecht/

Show quote
"Inthi" <In***@discussions.microsoft.com> wrote in message
news:15A98C63-85A0-467A-A6A0-9D5EAEBB53FC@microsoft.com...
> Dear all
> I am creating a tool in VC7.0 for database restoration
> I am facing a problem while working with sql dmo objects i need to restore
> a database, which has database location as "C:\Program Files\Microsoft SQL
> Server\MSSQL\Data\Sample.mdf" to new instance of SQlserver called as
> NEWINSTANCE.
>
> If i try to restore the database file with out modifying the location path
> then my restoration process is failing since "C:\Program Files\Microsoft
> SQL
> Server\MSSQL\Data\" does not exist in the new machine.
>
> So i need to change the database location file path as given below
> "C:\Program Files\Microsoft SQL Server\MSSQL$NEWINSTANCE\Data\Sample.mdf"
> but i am not able to figure out how to achive it
> can any one please help me out to solve the problem
>
> waiting in message loop for response message
>
> With Regards
>
>
Author
17 Dec 2005 12:12 PM
Tom Moreau
Please do not multi-post.  I answered this in .programming.

--
    Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON   Canada  t**@cips.ca
www.pinpub.com

Show quote
"Inthi" <In***@discussions.microsoft.com> wrote in message
news:15A98C63-85A0-467A-A6A0-9D5EAEBB53FC@microsoft.com...
> Dear all
> I am creating a tool in VC7.0 for database restoration
> I am facing a problem while working with sql dmo objects i need to restore
> a database, which has database location as "C:\Program Files\Microsoft SQL
> Server\MSSQL\Data\Sample.mdf" to new instance of SQlserver called as
> NEWINSTANCE.
>
> If i try to restore the database file with out modifying the location path
> then my restoration process is failing since "C:\Program Files\Microsoft
> SQL
> Server\MSSQL\Data\" does not exist in the new machine.
>
> So i need to change the database location file path as given below
> "C:\Program Files\Microsoft SQL Server\MSSQL$NEWINSTANCE\Data\Sample.mdf"
> but i am not able to figure out how to achive it
> can any one please help me out to solve the problem
>
> waiting in message loop for response message
>
> With Regards
>
>

AddThis Social Bookmark Button