In the last post, we have backed up the database using the SQL Server Management Studio.
Now we are going to do the same using SQL Query.
If you want to extract the Query that the SQL Server is using when backing up a database, it is simple.
Right Click on the Database, –> Tasks –> Backup. This will open the Backup database window.
On the top of Back up database window, Click on the Script button and select option, “Script Action to New Query Window”
This will give the SQL Query to backup that database in the new query window.
BACKUP DATABASE [AdventureWorks2008R2] TO DISK = N'D:\SQL DB\BACKUP\AdventureWorks2008R2.bak' WITH NOFORMAT, NOINIT, NAME = N'AdventureWorks2008R2-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10 GO
Give the Path and Name for the backup in the query and Run this query. This will take the backup of that database in that path.