Table-level backup

前端 未结 16 1575
孤城傲影
孤城傲影 2020-12-02 06:37

How to take table-level backup (dump) in MS SQL Server 2005/2008?

16条回答
  •  一整个雨季
    2020-12-02 07:06

    You cannot use the BACKUP DATABASE command to backup a single table, unless of course the table in question is allocated to it's 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

    Hope this helps but feel free to contact me directly if you require further assitance.

提交回复
热议问题