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
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