增加"定时删除数据库S1270一年以上数据"

This commit is contained in:
liming 蔡
2026-07-28 09:59:42 +08:00
parent af014ed33c
commit 799fb8ff06
4 changed files with 122 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
@echo off
:: 设置日志文件路径
set LOGFILE=D:\BatLogs\DeleteOldData_%date:~0,4%%date:~5,2%%date:~8,2%.log
:: 如果 D:\BatLogs 目录不存在,则创建
if not exist "D:\BatLogs" mkdir "D:\BatLogs"
sqlcmd -S .\SQLEXPRESS -d S1270 -E -Q "EXEC sp_DeleteOldData_Batch" >> "%LOGFILE%"
echo. >> "%LOGFILE%"
exit /b %ERRORLEVEL%
pause