通过运行具有不同条件的相同查询创建多个平面文件 [英] Create multiple flat file from running same query with different criteria

查看:21
本文介绍了通过运行具有不同条件的相同查询创建多个平面文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的数据库表中有 1000 万个客户编号.我想每次为前 100 万客户运行查询并将该数据保存在 .csv 文件中.我怎样才能用 SSIS 包做到这一点?例如,

I have 10 Million customer numbers in my data base table. I want to run query every time for first 1 million customers and save that data in .csv file. How can I do that with SSIS package? Ex ,

第一次:

选择名字、姓氏、客户 ID来自客户客户 ID 介于 1 到 1,000,000 之间

Select First name, Last name, Customer Id From Customer Where Customer Id between 1 to 1,000,000

现在获取结果并将数据存储在本地的 test1.csv 文件中.

Now get the result and store data in test1.csv file on local.

第二次:

选择名字、姓氏、客户 ID来自客户客户 ID 介于 1,000,001 到 2,000,000 之间

Select First name, Last name, Customer Id From Customer Where Customer Id between 1,000,001 to 2,000,000

现在获取结果并将数据存储在本地的 test2.csv 文件中.

Now get the result and store data in test2.csv file on local.

1000 万客户数量应该是动态的,这不是固定的,下次可能是 2000 万,所以我们必须在数据库上运行相同的查询 20 次.

10 million customer number should be dynamic,,It is not fix, next time it may be 20 millions so, we have to run same query 20 times on database.

谢谢,桑杰

推荐答案

在这里你也能找到好的解决方案http://social.msdn.microsoft.com/Forums/en-US/sqlintegrationservices/thread/91cdfb63-3368-4049-b3a0-37faeffc4cdb

Here you find also good solution http://social.msdn.microsoft.com/Forums/en-US/sqlintegrationservices/thread/91cdfb63-3368-4049-b3a0-37faeffc4cdb

这篇关于通过运行具有不同条件的相同查询创建多个平面文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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