sqlserver 添加作业备份数据库
优点:操作简单
缺点:不能实时备份
--备份 declare @filename varchar(255) select @filename='E:\MES-BAK\MES'+left(replace(replace(REPLACE(convert(varchar(100), GETDATE(),120),':',''),'-',''),' ',''),12)+'.BAK' backup DATABASE PersonDB to disk=@filename WITH NOFORMAT, NOINIT, SKIP, REWIND, NOUNLOAD, COMPRESSION,STATS = 10 go --删除 DECLARE @date DATETIME --select @date= dateadd(minute,-30,GETDATE()) SELECT @date= getdate()-5 execute master.dbo.xp_delete_file 0,N'E:\MES-BAK',N'bak',@date,1 go
效果:
标签:--,备份,sqlserver,数据库,date,filename,BAK From: https://www.cnblogs.com/pandora2050/p/17475096.html