|
Posted by Surfzoid on November 3, 2008, 5:57 am
Please log in for more thread options
I know it is a details, but like this it could more easy and flexible :
@For /F "tokens=2,3,4 delims=/ " %%A in ('Date /t') do @(
Set Month=%%A
Set Day=%%B
Set Year=%%C
)
set BaseName=MyBase
set BckDestDir=c:toMyPath
osql -U sa -P SQLPASSWORD -S NETBIOSNAME -Q "BACKUP DATABASE [%BaseName%] TO
DISK = '%BckDestDir%%Day%-%Month%-%Year%.BCK'"
"Steve" wrote:
> Thanks Haik! I will give that a try.
>
> "Haik" wrote:
>
> > This script works perfectly, I have been using it for years.
> >
> > @For /F "tokens=2,3,4 delims=/ " %%A in ('Date /t') do @(
> > Set Month=%%A
> > Set Day=%%B
> > Set Year=%%C
> > )
> >
> > osql -U sa -P SQLPASSWORD -S NETBIOSNAME -Q "BACKUP DATABASE [DBNAME] TO
> > DISK = 'C:Path%Day%-%Month%-%Year%.BCK'"
> >
> >
> > This is backup the DB and also label it with the date it was backed up on.
> > Very useful.
> > "Steve" wrote:
> >
> > > Does anyone have a .bat script for Microsoft RMS 2.0 for auto backup? I've
> > > tried the following, but did not have any luck..
> > >
> > > osql -U sa -P password -S servername -Q "BACKUP DATABASE
> > > databasename TO DISK = 'c:database.bck'WITH FORMAT, STATS"
> > >
> > > Any help will be greatly appreciated.
|