首页 > 代码库 > SqlAgent备份脚本

SqlAgent备份脚本

declare @dbname varchar(255)declare @back_path varchar(255)set @dbname=emcpset @back_path= e:\+@dbname+\+@dbname    +convert(varchar(9),getdate(),112)    +CAST(datepart(hour,getdate()) as char(2))    +CAST(datepart(minute,getdate()) as char(2))    +CAST(datepart(second,getdate()) as CHAR(2))    +.bakexec(use [+@dbname+])exec(backup database [+@dbname+] to disk=‘‘‘+@back_path+‘‘‘‘)

 

SqlAgent备份脚本