Hi,
Have anybody with success done a full backup/restore via a script and TMSSQL?
It seems like I can't get the '-sign into the SQL string, so I can't setup the backup filename (via the N'c:\temp\backupname.bak') and it keep on saying that there is an incorrect syntax near GO-stement.
So anyone succeded?
-Kurt
Backup via script?
Here is a code example of backing up a database:and of restoring a database:But note that the TMSDump component serves for storing data from tables or editable views as a script, and for restoring data from a received script. It means that TMSDump doesn't create code for creating or dropping tables, it creates code only for their data.
Code: Select all
MSConnection.Server := 'server';
MSConnection.Database := 'database';
MSConnection.Username := 'username';
MSConnection.Password := 'password';
MSConnection.LoginPrompt := False;
MSDump.Connection := MSConnection;
MSDump.BackupToFile('filename');
Code: Select all
MSConnection.Server := 'server';
MSConnection.Database := 'database';
MSConnection.Username := 'username';
MSConnection.Password := 'password';
MSConnection.LoginPrompt := False;
MSDump.Connection := MSConnection;
MSDump.RestoreFromFile('filename');
Last edited by AndreyZ on Fri 07 Oct 2011 15:26, edited 1 time in total.