如何进行定制的数据库备份. [英] How to take customized database backup.
本文介绍了如何进行定制的数据库备份.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个数据库,里面有一些表.现在每个表都有1000多个数据.现在,我想备份数据库,但是每个表将包含前100个数据.可能吗?如果是,那么如何.
我的意思是我要进行自定义备份.目前,如果我进行备份,则将复制所有数据.
NB:服务器名称-MS SQL 2008 R2
有没有人可以帮助我解决这个问题.
谢谢与问候
Rashed
I have a database it has some tables. Every tables has now more than 1000 data. Now I want to take a backup of my database but every table will have top 100 data. Is it possible? If yeas then how.
I mean I want to take customized backup. Currently if I take backup then every data is copied.
NB: Server Name- MS SQL 2008 R2
Is there any one to help me about this problem.
Thanks & regard
Rashed
推荐答案
是的,有可能,但是我想知道为什么您只想备份100条记录...
步骤:
1)创建数据库的副本(仅复制结构).
2)编写自定义sql命令,将数据从一个数据库复制到备份(逐表),如下所示:
Yes, it''s possible, but i wondering why do you want to back up only 100 records...
Steps:
1) Create the duplicate of your database (copy only structure).
2) Write custom sql command to copy data from one database into back-up (table by table), like this:
INSERT INTO [DestinationDatabase].[dbo].[Table1].*
SELECT TOP(100) *
FROM [SourceDatabase].[dbo].[Table1]
如果只想备份最后100条记录,则需要使用ORDER BY
子句:
If you want to back-up only last 100 records, you need to use ORDER BY
clause:
ORDER BY [DateOfRecordChange] DESC
这篇关于如何进行定制的数据库备份.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文