5

I have sql server database files (Mdf/Ldf) and i want to convert them to backup file using T-SQL commands or .net Code (C# or Vb.net).

any suggestions.

thans

Amr Elnashar
  • 1,739
  • 12
  • 33
  • 53

1 Answers1

3
BACKUP DATABASE [NameOfDatabase] TO  DISK = N'D:\path\filename.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...

Original source - http://forums.asp.net/p/1448416/3870094.aspx

Sachin Shanbhag
  • 54,530
  • 11
  • 89
  • 103