Table-level backup

You cannot use the BACKUP DATABASE command to backup a single table, unless of course the table in question is allocated to its own FILEGROUP.

What you can do, as you have suggested, is export the table data to a CSV file. Now in order to get the definition of your table you can ‘Script out’ the CREATE TABLE script.

You can do this within SQL Server Management Studio, by:

right clicking Database > Tasks > Generate Script

You can then select the table you wish to script out and also choose to include any associated objects, such as constraints and indexes.

in order to get the DATA along with just the schema, you’ve got to choose Advanced on the set scripting options tab, and in the GENERAL section set the Types of data to script select Schema and Data.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)