If you just want a script Transact-SQL to do the backup, you can use something like:
USE SeuBanco;
GO
BACKUP DATABASE SeuBanco
TO DISK = 'Z:\SQLServerBackups\SeuBanco.Bak'
WITH FORMAT,
MEDIANAME = 'Z_SQLServerBackups',
NAME = 'Backup Full do SeuBanco';
GO
The basic syntax is:
BACKUP DATABASE nomeDoBanco
TO lugarOndeSeraGravado
See more details about the syntax for creating the script here and if you want to generate backups of differential from a full backup may use the clause DIFFERENTIAL.
But it is recommended you program one job to automate this using SQL Server Agent.
Right click on Jobs and then on New Job...
In the guide General, in Name, write the name you find convenient for your job.
In the guide Steps, click on the button New for you to create the steps of your job.
Enter a name for the step, type of the backup, the script and set up the schedule.
For more details, have a look here.
Dude, starts a code and when the doubts arise we help... Although I think there is how to change some configuration of SQL Server to do this.
– LucasMotta
So the point is, I have no idea how to do this. (. I’ve already researched, but I didn’t find anything that relevant. Or else I didn’t look right.
– Érik Thiago
I think the question is valid. It’s short, objective, doesn’t depend on opinion, doesn’t require too broad a response and is something that many developers don’t know how to do. In addition to the +1 goes a favorite. P.S.: I am not the Renan who replied.
– Oralista de Sistemas
Exactly. There are many who do not know how to do it, including me, let alone where to start the research. And thank you very much for the favorite !
– Érik Thiago