dtexec 调用SSIS包,如何传入多个参数?

castlooo 2010-03-12 10:09:05
dtexec /f "C:\UpsertData.dtsx" /SET \package.variables[@year].Value;2009
.....
...全文
340 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
castlooo 2010-03-12
  • 打赏
  • 举报
回复
select @cmd = @cmd + ' /SET \Package.Variables[User::filePath].Properties[Value];"' + @filePath + '"'
找不到包的Package.Variables[User::filePath].Properties[Value] 怎么解决?
playwarcraft 2010-03-12
  • 打赏
  • 举报
回复
dtexec /f "C:\UpsertData.dtsx" /SET \package.variables[@year].Value;"1%" /Set \package.variables[@other].Value;"2%"
Zoezs 2010-03-12
  • 打赏
  • 举报
回复
你要传什么吗参数?数据源的连接字符串?还是什么?
castlooo 2010-03-12
  • 打赏
  • 举报
回复
declare @cmd varchar(1000)
declare @ssispath varchar(1000)
declare @filePath varchar(1000)
declare @fileName varchar(1000)
set @ssispath = 'C:\temp\Package2.dtsx'
set @filePath = 'C:\temp\\'
set @fileName = 'test.csv'

select @cmd = 'dtexec /F "' + @ssispath + '"'
select @cmd = @cmd + ' /SET \Package.Variables[User::filePath].Properties[Value];"' + @filePath + '"'
select @cmd = @cmd + ' /SET \Package.Variables[User::fileName].Properties[Value];"' + @fileName + '"'

exec master..xp_cmdshell @cmd
--小F-- 2010-03-12
  • 打赏
  • 举报
回复

不懂 帮顶
Ray_Zhang 2010-03-12
  • 打赏
  • 举报
回复
我给楼主个建议吧,就我的理解你是要把文件路径当成参数传对吧,其实是可以有变通的方法的,你这个路径会经常变吗,有没有逻辑呢,我建议有逻辑的话可以写在Execute SQL Task Editor里
先对整个包定义字符变量strFilePath

在 General 的SQLStatement里写 SELECT 'C:\temp\test.csv' AS filePath
然后在Result Set写Result name=filePath Variable name=User::strFilePath
然后成功连接到你现在包里调用变量的控件就行了,这个方法既方便又简单,你试试,我也在研究用dtexec 传参的问题,如果你有什么方法我们可以交流看看

591

社区成员

发帖
与我相关
我的任务
社区描述
提出问题
其他 技术论坛(原bbs)
社区管理员
  • community_281
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧