CREATE PROCEDURE [dbo].[back_pubs_time] AS declare @filename nvarchar(100),–文件名 @NowDay int –设置时间 set @filename=’F:/JXXdata’ cast(Day(GetDate()) as varchar(2)) ’.dat’ –文件路径及文件名 Set @NowDay=Day(GetDate()) if (@NowDay>=20) or (@NowDay<=10) –这个月的20到下个月的10要备份 begin print @filename BACKUP DATABASE [pubs]–数据库名你也可以设参数 TO DISK = @filename WITH INIT , NOUNLOAD , NAME = N’XX数据备份’, NOSKIP , STATS = 10, NOFORMAT end
exec back_pubs_time
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/100638.html原文链接: