Restores with T-SQL

The command to restore a database in SQL Server is aptly named RESTORE. The RESTORE command is similar to the BACKUP command in that it can be used to restore a database, part of a database, or a transaction log. You restore an entire database or part of a database by using the RESTORE DATABASE syntax. You do transaction log restores by using the RESTORE TRANSACTION syntax.

Database Restores with T-SQL

Listing 11.6 shows the full syntax for RESTORE DATABASE.

LISTING 11.6 RESTORE DATABASE Syntax

--To Restore an Entire Database from a Full database backup(a Complete Restore):RESTORE DATABASE { database_name | @database_name_var }[ FROM <backup_device> [ ,...n ] ][ WITH   [ { CHECKSUM | NO_CHECKSUM ...

Get Microsoft SQL Server 2014 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.