简体   繁体   English

SSIS Sql Server配置以在多个目录中加载多个平面文件

[英]SSIS Sql Server Configuration to load multiple flat files in multiple directories

I'm working on an SSIS project to load multiple flat files in multiple directories into a SQL Staging table. 我正在一个SSIS项目中,将多个目录中的多个平面文件加载到SQL Staging表中。

FTP Path | FTP路径| File Name | 文件名| Headers | 标头| Delimiter 定界符
E:\\ftp\\Gems | E:\\ ftp \\ Gems | PD_INV.txt | PD_INV.txt | Y | Y | Pipe
E:\\ftp\\Janos | E:\\ ftp \\ Janos | pd_invc.txt | pd_invc.txt | Y | Y | Pipe
E:\\ftp\\Flk121 | E:\\ ftp \\ Flk121 | PDINV.txt | PDINV.txt | Y | Y | Pipe
E:\\ftp\\GVRS | E:\\ ftp \\ GVRS | pdinvc.txt | pdinvc.txt | Y | Y | Pipe

I've figured out how to add a variable and I'm able to loop through it they're all in the same directory; 我已经弄清楚了如何添加变量,并且可以遍历它们,它们都在同一目录中。 but I can't seem to understand how to use the SQL Configuration option to load a table will the above information to extract the files from these locations. 但我似乎无法理解如何使用“ SQL配置”选项加载表,将上述信息从这些位置提取文件。 Please help... 请帮忙...

Create an execute sql task with a result set to an object variable. 创建一个执行sql任务,并将结果设置为对象变量。 Or you can use a data flow task to recordset destination (with object variable). 或者,您可以使用数据流任务来记录目标位置(带有对象变量)。 In both cases your query would be select ftppath, filename, headers, delimiter from controltable. 在这两种情况下,您的查询都是从controltable中选择ftppath,文件名,标头和定界符。

Then you use a for loop container with ado enumeration to iterate this recordset and set variables from the object variable. 然后,使用带有ado枚举的for循环容器来迭代此记录集并从对象变量中设置变量。 This container will execute once for each record in your control table. 此容器将对控制表中的每个记录执行一次。

Using ftppath and filename you can use your current looping, inside the newly created for loop container to run for each folder or if you have file names in a table you can just do them one at at time. 使用ftppath和filename,您可以使用当前循环,在新创建的for循环容器中为每个文件夹运行,或者如果表中有文件名,则一次只能执行一次。

Hope this makes sense. 希望这是有道理的。 There are many articles easy to find on the web about the techniques I described. 在网上可以找到很多关于我描述的技术的文章。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM