Lob*_*nts 5 sql-server ssis fileinfo
我们有一个SSIS流程,可以从各种来源导入不同格式的各种文件.这些文件中的每一个都在整个月的不同时间交付.
用户希望能够查看每个文件的修改日期,以检查他们是否定期更新.
目标是在流程结束时生成一个表格,如下所示:

所以我想弄清楚如何获取我读过的每个文件的修改日期.有没有办法在SSIS中执行此操作?
提前致谢
Ste*_*ord 11
您可以将一个脚本组件添加到管道,该管道从输入变量读取文件名,并将文件修改日期写入输出变量:
/// <summary>
/// This method is called when this script task executes in the control flow.
/// Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.
/// To open Help, press F1.
/// </summary>
public void Main()
{
System.IO.FileInfo theFile =
new System.IO.FileInfo(Dts.Variables["User::FilePath"].Value.ToString());
if (theFile.Exists)
{
Dts.Variables["User::LastFileDate"].Value = theFile.LastWriteTime;
}
Dts.TaskResult = (int)ScriptResults.Success;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9828 次 |
| 最近记录: |