如何使用where子句从数据库生成脚本 [英] How to generate script from database with where clause

查看:86
本文介绍了如何使用where子句从数据库生成脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

> Hello Sir





我有很多数据进入表格,不想从表格中生成全部数据我想只生成那些我需要的数据



喜欢



选择* Frin Table其中Datayear ='2016'





所以请指导我怎么做



beacuse如果我生成整个表数据然后我在生成脚本期间得到异常



我尝试过:



我需要数据所以请帮助我我想尝试生成像右键单击数据库

任务,然后生成类似

>Hello Sir


I have lots of data in to a table and do not want to generate whole data from table i want to generate only those data which is i need required

like

Select * Frin Table where Datayear='2016'


so please guide me how to do

beacuse if i generate whole table data then i get exception during generate script

What I have tried:

I Need Data so Please help Me i am trying to generate like right click on database
task ,then generate script like that

推荐答案

SQL Server中没有内置任何内容来生成此类脚本。原因是where子句对于你的每个表都不同。您需要编写自己的代码来导出部分数据。



如果您在特定日期之后查找数据,备份可能会有所帮助。如果您采取增量备份,您将在上次完全备份之后获得所有数据
There is nothing built-in in SQL server to generate such scripts. Reason being that the where clause would be different for each table of yours. You will need to write your own code to export partial data.

If you are looking for data after certain date, backups might help. If you take incremental back up, you will get all the data after the date of last full back up.


这篇关于如何使用where子句从数据库生成脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆