Board index » delphi » Backup & Restore at MSSQL Server 7

Backup & Restore at MSSQL Server 7

I'm having problem RESTORING a database.
With SQL Query, there's no problem for full backup.
But, when restoring the backup file,
There's no error message but DB is still the same.
When I apply the same SQL Query at Quary Analyzer,
It WORKS!!

Can anyboy tell me what do I have to do to implement restore with Delphi?

SQL query is as below;

====================================================
              SQL.Add(' Use master                      ');
              SQL.Add(' Exec sp_dboption ''MyDB''  ,  ''DBO use only'' ,
true ');
              SQL.Add(' Exec sp_dboption ''MyDB''  ,  ''Single user'' ,
true ');
              SQL.Add(' Restore Database POPS from DISK= C:\DB\MyDbBackup
with Replace, recovery ');
              SQL.Add(' move ''pops_data''  to
''c:\pops\backup\pops_data.mdf'', ');
              SQL.Add(' move ''pops_log''  to
''c:\pops\backup\pops_log.ldf'' ');
====================================================

 

Re:Backup & Restore at MSSQL Server 7


Andrew,

Are you calling the ExecSQL method after you populate the SQL
property, or just opening the query?

-Jim

Quote
"Andrew Lee" <andy_...@fishround.com> wrote in message

news:3b9ec02a_2@dnews...
Quote
> I'm having problem RESTORING a database.
> With SQL Query, there's no problem for full backup.
> But, when restoring the backup file,
> There's no error message but DB is still the same.
> When I apply the same SQL Query at Quary Analyzer,
> It WORKS!!

> Can anyboy tell me what do I have to do to implement restore with Delphi?

> SQL query is as below;

> ====================================================
>               SQL.Add(' Use master                      ');
>               SQL.Add(' Exec sp_dboption ''MyDB''  ,  ''DBO use only'' ,
> true ');
>               SQL.Add(' Exec sp_dboption ''MyDB''  ,  ''Single user'' ,
> true ');
>               SQL.Add(' Restore Database POPS from DISK= C:\DB\MyDbBackup
> with Replace, recovery ');
>               SQL.Add(' move ''pops_data''  to
> ''c:\pops\backup\pops_data.mdf'', ');
>               SQL.Add(' move ''pops_log''  to
> ''c:\pops\backup\pops_log.ldf'' ');
> ====================================================

Other Threads