数据库作业备份
var sql = string.Format(@"DECLARE @strPath NVARCHAR(200)
set @strPath = convert(NVARCHAR(19),getdate(),120)
set @strPath = REPLACE(@strPath, ':' , '.')
set @strPath = '{0}\' + @strPath + '.bak'
BACKUP DATABASE [XuChangGov_Pub_DB] TO DISK = @strPath WITH NOINIT , NOUNLOAD , NOSKIP , STATS = 10, NOFORMAT ",
HttpContext.Current.Server.MapPath(WebConfig.GetKeyString("dbCopy")));
set @strPath = convert(NVARCHAR(19),getdate(),120)
set @strPath = REPLACE(@strPath, ':' , '.')
set @strPath = '{0}\' + @strPath + '.bak'
BACKUP DATABASE [XuChangGov_Pub_DB] TO DISK = @strPath WITH NOINIT , NOUNLOAD , NOSKIP , STATS = 10, NOFORMAT ",
HttpContext.Current.Server.MapPath(WebConfig.GetKeyString("dbCopy")));
var dct = new MyDataContext(WebConfig.GetSqlConnectionString("Conn1"));
本文介绍了一段用于数据库作业备份的SQL脚本,通过动态生成备份文件路径,实现高效备份操作。

933

被折叠的 条评论
为什么被折叠?



