Menu ▼



Posted By :
avatarmrkraju
Total Views : 555

SQL Query to restore database from backup file

This example shows you how to restore SQL database from a backup file using SQL Query.

Example
USE MASTER
GO


ALTER DATABASE SampleDB
SET SINGLE_USER WITH ROLLBACK IMMEDIATE
Go


RESTORE DATABASE SampleDB
FROM DISK = N'E:\DB\Bakup\SampleDBBackupfile.bak'
Go


ALTER DATABASE SampleDB
SET MULTI_USER with ROLLBACK IMMEDIATE
Go


In the above example
SampleDB is the database name.
N'E:\DB\Bakup\SampleDBBackupfile.bak' physical path of backup file.






comments powered by Disqus


Search dotnetlearners.com