如何从SSI中的文件名获取日期
我的SSIS包具有数据流任务,并为每个循环容器执行SQL任务组件。软件包流量为,日期流量任务(平面文件 - >条件拆分以将数据插入SQL Server表中) - >执行SQL任务(对插入的数据执行一些SQL操作,并在一个最终分析表中插入计算值) 。文件名就像name1_name2_yyyymmdd_1234.txt。我想从文件名中获取日期,然后在SQL Server中的表中插入该日期值。我正在尝试使用派生的列进行操作,但无法弄清楚我们的何处可以保存它,以便它可以在Decute SQL任务中的插入语句中可用,该任务是在数据流任务之后。
I have SSIS package with data flow task and execute SQL task components in For each loop container. Package flow is, Date flow task(flat file--> Conditional split to insert data into SQL server tables)-->Execute SQL task(perform some SQL operations on inserted data and insert the calculated values in one final analysis table) . File name is like name1_name2_yyyymmdd_1234.txt. I want to fetch the date from file name and insert that date value in table in SQL Server as FileDate. I am trying to do it using derived column but unable to figure our where will I save it so that it will be available in Insert statement in Execute SQL Task which is after Data flow task.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这应该在数据流之外,但在foreach循环中进行。
将两个参数(软件包范围)传递到脚本任务。一个带有
@fileName
(仅读取)的一个,并存储@filedate(read/write)。Split将创建一个基于0的数组,您只关心第三件。
现在,您可以在任何地方使用@filedate。
This should be done outside the dataflow but within the ForEach loop.
Pass in two parameters (package scope) to a script task. One with the
@filename
(read only) from the forloop and to store the @fileDate (read/write).Split will create a 0-based array in which you only care about the third piece.
Now you can use @fileDate anywhere you would like.