DATETIME SELECT SELECT INTO DATE PAD STRING DYNAMIC SQL CURSOR MONEY FORMAT PERCENT STORED PROCEDURE SQL SERVER AGENT JOB OPTIMIZATION WHILE LOOP OVER PARTITION BY UPDATE
SITE SEARCH SQLUSA.com HEADLINES NEWS
SQL E/BOOKS   SQL 2014 PROGRAMMING   DOWNLOADS
SCRIPTS SQL 2005 SQL 2008 ARTICLES
SQL JOBS TWITTER FORMAT VIDEOS
How to backup a database with OSQL and SQLCMD?

The following sample scripts in command shell or in a .cmd file will backup database dbX:

OSQL -Usa -Psecret007 -n -Q "BACKUP DATABASE dbX TO DISK = 'c:\backup\dbx.bak'"

 

-- SQL Server 2005 and SQL Server 2008

SQLCMD -Usa -Psecret007 -Q "BACKUP DATABASE dbX TO DISK = 'c:\backup\dbx.bak'"

Related articles:

Tutorial: sqlcmd Utility

How to recover modified records from SQL Server without Backup

 

Exam Prep 70-461
Exam 70-461
DATETIME SELECT SELECT INTO DATE PAD STRING DYNAMIC SQL CURSOR MONEY FORMAT PERCENT STORED PROCEDURE SQL SERVER AGENT JOB OPTIMIZATION WHILE LOOP OVER PARTITION BY UPDATE