How to back up files and filegroups (Transact-SQL)

How to Install SQL Server 2000

How To

How to back up files and filegroups (Transact-SQL)

To back up files and filegroups

  • Execute the BACKUP DATABASE statement to create the file and filegroup backup, specifying:
    • The name of the database to back up.

    • The backup device where the database backup will be written.

    • The FILE clause for each file to back up.

    • The FILEGROUP clause for each filegroup to back up.
Examples

This example performs a backup operation with files and filegroups for the MyNwind database.

-- Back up the MyNwind file(s) and filegroup(s)
BACKUP DATABASE MyNwind
   FILE = 'MyNwind_data_1',
   FILEGROUP = 'new_customers',
   FILE = 'MyNwind_data_2', 
   FILEGROUP = 'first_qtr_sales'
   TO MyNwind_1
GO

See Also

BACKUP

File and Filegroup Backup and Restore