开发者

Taking backup of data in a table

开发者 https://www.devze.com 2023-01-04 06:37 出处:网络
Is there some way to backup the data in a table in sql server by开发者_开发问答 using sql scripts. Note: I dont want to take the backup of the whole database.

Is there some way to backup the data in a table in sql server by开发者_开发问答 using sql scripts. Note: I dont want to take the backup of the whole database.

And later on restore the same data back in case of any failure. Please suggest some solution.


It depends on how you want to have the backup. You can create a new table as the result on a query, which looks like this: CREATE TABLE foobar AS SELECT bar, baz FROM foo;.

You can also look in the documentation of your DB if the bachup programms accept the dump of specified tables only. PostgreSQL can do this with the --table parameter, mysql seems to do this when the table names are listed after the database name.


For Microsoft SQL Server 2005/2008 SSMS Tools Pack has a "Generate Insert Statements" function that can script out all the data in a table.


1 Generate script of the table

2 Bcp out the data to text file

0

精彩评论

暂无评论...
验证码 换一张
取 消