May 28, 2009 at 5:11 am
I have to backup the database in sql express.
I have created a procedure to backup the database.The procedure is used in SQLCMD which is a bat file. I have scheduled the backup of the
database using the windows task schedular.The backup works fine but the the command prompt after the backup is over just hangs. I want the command prompt to close the window automatically when the job is
done.
The procedure is given below.
CREATE PROCEDURE BackUPDatabase
as
BACKUP DATABASE [Databasename] TO DISK = N'C:\DB Backups\Databasename.BAK' WITH INIT , NOFORMAT
The bat file is given below
SQLCMD -q"Exec BackUPDatabase " -Uusername -Ppassword -Sservername
How can I exit from the cmd window automatically when job is over.
May 28, 2009 at 9:53 am
Direct from books online's help about SQLCMD:
[ -q "cmdline query" ] [ -Q "cmdline query" and exit ]
Which one do you think you should use?
Jeffrey Williams
Problems are opportunities brilliantly disguised as insurmountable obstacles.
How to post questions to get better answers faster
Managing Transaction Logs
May 29, 2009 at 1:05 am
Hi thanks it works I did not know it is this simple I replaced -q with -Q the command prompt closes when the backup job is finished.
May 29, 2009 at 9:20 am
Glad I could help and you are now able to get this to complete.
Jeffrey Williams
Problems are opportunities brilliantly disguised as insurmountable obstacles.
How to post questions to get better answers faster
Managing Transaction Logs
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply