how to backup and restore database in sql server code example
Example 1: sql restore backup query
RESTORE FILELISTONLY
FROM DISK = 'D:BackUpYourBaackUpFile.bak'
Example 2: sql server restore database
RESTORE FILELISTONLY
FROM DISK = 'E:\DBBackups\mydb.bak'
RESTORE DATABASE [mydb_new]
FILE = N'<MDFLogicalName>'
FROM DISK = N'E:\DBBackups\mydb.bak'
WITH FILE = 1
,NOUNLOAD
,STATS = 10
,MOVE N'<MDFLogicalname>' TO N'E:\DBBackups\mydb_new.mdf'
,MOVE N'<LDFLogicalName>' TO N'E:\DBBackups\mydb_new_0.ldf'