Wednesday, February 18, 2015

Make backup of database file .mdf

.mdf to .bak Or Make a backup of databases file.

Simple and Beautiful,

BACKUP DATABASE [NameOfDatabase] TO  DISK = N'D:\path\yourdatabase.bak' 
WITH NOFORMAT, NOINIT,  NAME = N'NameOfDatabase-Full Database Backup', 
SKIP, NOREWIND, NOUNLOAD,  STATS = 10  

Replace NameOfDatabase with name of your database.
Replace D:\path\filename.bak with place you want to backup with
Replace Name = N database name for cosmetic indexing reasons...
 
Example: