sql server - How to compress DB backup file with sql query -


I backup my database:

  use DBNAME GO announced @FileName VARCHAR with this query (Max) set @FileName = 'C: \ backup \ SQLDB \ dBNAME _' + REPLACE (CONVERT (varchar (10), getdate (), 103), '/', '') + '_' + REPLACE (CONVERT (varchar (10), getdate (), 108), ':', '') + '.bak' backup database @FileName with disk = format to dBNAME, name = 'dBNAME' Go full backup   

I execute this query with a batch file and batch file run from schedule work

Batch file parameters:.

  sqlcmd -d dBNAME S \ SQLEXPRESS I U DBUserName -P DBUserPwd I SQL_FileName_with_Extension -o log.txt  

It successfully DBName_01082014_131210.bak < With daily / daily code and I got my backup database on the backup file> name but its size is very high (about 7 GB). Is there any SQL query which can query the above and which can backup and execute with my DB compress at the same time?

You sqlcmd database for a .bat can file database name stores backups in a variable Use and after the compressed backup, it is complete using the variable db file name.


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -