SQL2008-备份SQL数据库的语句

SQL2008:
1.备份库
BACKUP DATABASE CDJQ_CEM2008 TO DISK = 'd:zhu123.bak'
2.开启RAR加压功能
EXEC sp_configure 'show advanced options', 1
GO
RECONFIGURE
GO
EXEC sp_configure 'xp_cmdshell', 1
GO
RECONFIGURE
3. 加压
declare @file varchar(100)
set @file='D:WinRARWinRAR.exe a -ep -df D:zhu123.bak'
exec master..xp_cmdshell @file

原文地址:https://www.cnblogs.com/karkash/p/7763141.html