将多个文本文件插入到具有不同表结构的多个表中 [英] Insert multiple text files to multiple tables that have different table structures

查看:97
本文介绍了将多个文本文件插入到具有不同表结构的多个表中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有业务要求。我在文件夹位置有很多文本文件。比如说:

** Sales_Newyork_1102_2012.txt **

** Sales_Texas_1102_2012.txt **

** Sales_Dallas_1102_2012.txt ** 。



我需要将所有这些文件插入到与文件结构类似的表中。 Sales_Newyork_1102_2012文件到Sales_Newyork表和Sales_Texas文件到Sales_Texas表,Sales_Dallas_1102_2012文件到Sales_Dallas表。



问题是所有这些表结构彼此不同。



如何使用SSIS执行此操作?我想对每个循环使用一个数据流任务将是一个开始。



有些机构能给我一步一步的例子说明我如何实现这一目标。



提前致谢

I have a Business Requirement. I have lots of text files in a folder location. Say for an example:
**Sales_Newyork_1102_2012.txt**
**Sales_Texas_1102_2012.txt**
**Sales_Dallas_1102_2012.txt**.

I need to insert all these files to tables similar to the file structure. Sales_Newyork_1102_2012 file to Sales_Newyork table and Sales_Texas file to Sales_Texas table and Sales_Dallas_1102_2012 file to Sales_Dallas table.

The catch is that all these table structures differ one to another.

How can i do this using SSIS? I guess using a for each loop with some data flow task would be a start.

Can some body give me a step by step example on how i can achieve this.

Thanks in advance

推荐答案

有些文章你可以阅读



这是一个 SSIS - 导入文本文件 [ ^ ]



这是另一个:在SQL Server Integration Services中循环遍历平面文件 [ ^ ]



附注。根据您拥有的数据量,最好考虑使用一个表并添加一个具有状态名称的列。
There are some articles out there you can read

Here is one SSIS - Import Text File[^]

Here is another one: Loop through Flat Files in SQL Server Integration Services[^]

On a side note. Depending on how large the data you have is, it might be better to consider to use one table and add a column with the name of the state.


这篇关于将多个文本文件插入到具有不同表结构的多个表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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