我创建了5个ssis包,我需要使用文件监视器来执行它们,文件监视器监视文件夹中的文件并执行相应的包。文件名称类似于 * _201307.txt, ** _201308.txt等根据月份更改。这是我的代码
private void OnChanged(object source, FileSystemEventArgs e)
{
// Specify what is done when a file is changed, created, or deleted.
//Console.WriteLine("File: " & e.FullPath & " " & e.ChangeType)
//logger.Info("Realtime file watcher activity: change type [" + e.ChangeType + "] file [" + e.Name + "]");
Console.WriteLine("Realtime file watcher activity: change type [" + e.ChangeType + "] file [" + e.Name + "]");
if (_watcherActivityList.Count > 10000)
{
//logger.Warn("Realtime file watcher activity list is over 10,000 items, clearing list");
_watcherActivityList.Clear();
}
else
{
//under 10,000 items
}
_watcherActivityList.Add(e.ChangeType + "|" + e.FullPath);
if (e.ChangeType == WatcherChangeTypes.Created)
{
/*** THIS IS WHERE YOU'LL CALL YOUR SSIS PACKAGE ***/
}
有人可以在这里发布代码/ *这就是你打电话给你的SSIS包* /
答案 0 :(得分:0)
我会建议你使用这些方法:
sp_start_job
命令从过程中启动SSIS包。Process
。Process
启动SSIS包并提供用户变量作为参数。电话会是这样的:dtexec / file SSISPackage.dtsx / Set \ Package.Variables [User :: Filename] .Properties [Value]; \“myFile.txt \”