2012-12-07 24 views
0

我有一个PowerShell脚本执行以下任务:在Powershell脚本中使用SQL Server Service Broker?

Loop a big database table 
    Generate text file 
    Zip the text file 
    FTP upload the zipped file 
    Write to the log table 

步骤生成文本文件可能需要短期或更长的时间依赖于数据。而FTP上传时间需要一段时间。所以我想至少使这两个步骤异步。 SQL Server Service Broker是一个可行的选择吗?有没有例子?任何其他选项?

回答

0

你不能在PowerShell中使它们成为aysnc,但是你可以使用Start-Job cmdlet将它们放到另一个线程上并等待它们完成。

0

使用Service Broker将默认使它们异步工作。棘手的事情是,如果你仍然想要顺序运行一些,那么你需要为它们添加一个对话组ID。

相关问题