Create a Mybackup.bat, enter the following to run the script directly, you can start to automatically back up the database or the script to join the Windows task plan to execute.
@echo off
set path=%path%; C:Program Files\Microsoft SQL Server\80\Tools\Binn
Echo Database backup start >> E:\DataBaseBAK\ task schedule completion. txt
date/t >> E:\DataBaseBAK\ Task Schedule completion of the
. txt time/t >> E:\DataBaseBAK\ Task Schedule completion of a
. txt isql.exe-s 127.0.0.1-u SA- P sa-i mybackup.sql
Echo Database backup completion >> E:\DataBaseBAK\ task schedule complete records. txt
date/t >> E:\DataBaseBAK\ Task scheduled to complete the
. txt time/t >> E:\DataBaseBAK\ task scheduled completion
. txt echo.
Echo.
Echo. Database backup completes
echo.
Echo.
REM Pause
In the same folder, create a SQL script: Mybackup.sql
The contents are as follows:
----------------------------------------------------------------------------
DECLARE @name varchar ()
DECLARE @datetime char (a)
DECLARE @path varchar (255)
DECLARE @bakfile varchar ( 255)
Set @name = ' V5hqs '
set @datetime =convert (char (8), GETDATE (), 112) + REPLACE (CONVERT (char (8), GETDATE (), 108), ': ', '
set @path = ' E:\DataBaseBAK '
set @bakfile = @path + ' + @name + ' _ ' + ' bak_ ' + @datetime + '. BAK '
backup database @name to disk= @bakfile and name= @name
go
The above is a small part of the introduction to the Windows Batch command to perform SQL Server database backup related content, I hope that the above help!