0

I am working on a project with multi users who can store their individual data. I am confused on how to proceed if a user wants to save his own data from multiple tables as a backup and retrieve it any time if the data is lost or corrupted if anyone has any clue on how to do that would be a great help.

lmiguelvargasf
  • 63,191
  • 45
  • 217
  • 228
  • Possible duplicate of [Backup a single table with its data from a database in sql server 2008](http://stackoverflow.com/questions/19698310/backup-a-single-table-with-its-data-from-a-database-in-sql-server-2008) – Paweł Tajs May 15 '17 at 08:25

1 Answers1

0

You cannot backup specific tables to a .bak file, but you can export them to a CSV or script them out. What you can do if you want to back up specific tables is move them into a separate file group and back up that file group.

See Back Up Files and Filegroups for the documentation.

Below is an example.

--Back up the files in SalesGroup1.
BACKUP DATABASE Sales
   FILEGROUP = 'SalesGroup1',
   FILEGROUP = 'SalesGroup2'
   TO DISK = 'C:\MySQLServer\Backups\Sales\SalesFiles.bak';
GO
samithagun
  • 664
  • 11
  • 25