Backup a Database Using TSQL
Published: 3rd May 2013
This is actually the cleanest and quickest way to produce a backup as it is a one line command in the form of:

BACKUP DATABASE <database_name> TO DISK = <backup_device>


In this following example I want to make a backup of the boredDBA database to a folder on my C drive:

backup database boredDBA to disk = 'c:\backup\boredDBA.bak'


This produces a full backup of the boredDBA database. The following are the commands to perform a Differential and Transactional backup respectively:

backup database boredDBA to disk = 'c:\backup\boredDBA.dif' with differential


backup log boredDBA to disk = 'c:\backup\boredDBA.trn'


As you can see, it’s very simple to perform your backups with scripts and therefore with just a few tweaks (maybe adding a timestamp to your backup file name, for example) you can quickly create a simple scheduled task to run your custom backup strategies.

Comments:
NB: Comments will only appear once they have been moderated.