1. Create the following stored procedure on the data to be backed up:
Create procedure [DBO]. [process name]
Declare
@ Filename nvarchar (100), -- file name
@ Nowday int -- set the time
Set @ filename = 'f: \ jxxdata '+ Cast (Day (getdate () as varchar (2) +'. dat '-- file path and file name
Set @ nowday = Day (getdate ())
If (@ nowday> = 20) or (@ nowday <= 10) -- back up the data from 20 to 10 of the next month.
Begin
Print @ filename backup database [Database Name () You can also set the parameter] to disk = @ filename with init, nounload, name = n'xx data backup ', noskip, stats = 10, noformat
End
The stored procedure must be debugged correctly.
2. Choose Enterprise Manager> Manage> SQL Server proxy> job, create a job, and take the job name as needed. For example, data backup, select SA as the owner, you can also select another user, provided that the user has the permission to execute the job;
3. Name in step-select the database to be backed up-enter exec ('process name') in the command ')
4. Choose "change"> "Daily"> "time" in the scheduling system.
5. After testing, import the script to the server.
6. Enable the sqlserver service manager for the sqlserver agent service