1 动态改变数据源
package从创建到调试到测试到生产环境,往往需要运行在不同的服务器上。我们可以定义Environment和Server两个变量,一个用于改变 Server,一个用于接收实际Server的值。运行于不同的环境时,只用改一个Environment变量的值,Server及数据库连接就会随之改 变。
a. 定义Environment和Server变量
b.方法1:Server变量的EvaluateAsExpression设置为true,表达式填写为:
@[User::Environment]=="DEV"?"sqlServer\\dev":
(@[User::Environment]=="TEST"?"sqlServer\\test":
(@[User::Environment]=="PROD"?"sqlServer\\prod":"Unassigned"
))
b.方法2:在package开始前,放一个Sql执行任务(连接类型设置为ADO.NET),写上类似语句:
Select @Server = Server from PackageAdmin where Environment=@Environment && ApplicationName=@ApplicationName
然后给这个task添加必要的参数映射。这样可以根据数据库的配置,来动态改变其不同环境对应的DB Server。
c. 将连接对象的Expression中的ServerName绑定为Server变量。
2 OLE DB SQL Task
当Sql Task连接类型为OLE DB类型时,参数的映射和使用都将不同。
映射:参数的参数名不再是@XXX,而应该是其在sql语句中对应的序号。
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAn4AAAByCAIAAABC70tlAAATl0lEQVR4nO2dz2sbSZ/G67/KKfCSw6uXQF9yck5KQg6NDwloDglBYMwYclGUOYTwqsGQCUqaF+Mw0wfFM9D2eGGnM9lZRSysGTGeHbw3RTn4P+g91KT2m6rqH2qVulqq58NzaJdKXfWt7q5H9cMS+zT7DYIgCIKg2sSs1wCCIAiCnBKsF4IgCIJqFawXgiAIgmoVrBeCIAiCahWsF4IgCIJqFawXgiAIgmoVrBeCIAiCahWsF4IgCIJqFawXgiAIgmoVrBeCIAiCahWsF4IgCIJqFawXgiAIgmoVrBeCIAiCahWsF4IgCIJqFfs0+21n/wfITS10r1ivLQRB0GboL+tNgXvsLG69aZrOP/4OQRDkspbvfmG97gLrhSAIqqDlu19Yr7vAeiEIgipo+e4X1ususN7mKPn3yJG2RaSbJ3ciFcEuzwZaL2PMdhXWg+ZbL2NsofT1lTudFyLdPLkT6RzWmwOstyRNsN5b7Zs5r8J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dfq5eY6m82Ey1IjpD+sKxlkHMf8zyRJgiDgiepv7qopohpxHIs3agtKkkTMTrvza76wXgAAsEJ9a72z2SyKIt/3hbExxsQoNk1TMcaV0ulgV5zN87wkSWihaorITM9weXlJC1Izq+fZVGC9AABghVrXeumIU82mnShOs4282+1SI1dTck6opueceVOB9QIAgBXqs97ZbOb7fhiGqjWmaXp5eSmmfKW3i0GqynQ6lV6lKXQgS0e92oKkQtUzbx6wXgAAsEJ91tvtdrnpatd6u91uHMfat9OxsjjgmWezmTBINUWcJ4oiutarLYguDEvn2VRgvQAAYIWa1nrDMJxMJvzV6XQqdjjzDcaMsSiK6NulEwZBwBjzPE+cJIoivudZ7ExWU+h5+B7pnIKoT0vn2VRgvQAAYAWb32a18f+903BgvQAAYAVYr7vAegEAwAqwXneB9QIAgBU2+ecTQD6wXgAAsAKs111gvQAAYAVYr7vAegEAwAqwXneB9QIAgBVgve4C6wUAACvAet0F1gsAAFaA9boLrBcAAKwA63UXWC8AAFgB1ususF4AALACrNddYL0AAGAFWK+7wHoBAMAKsF53gfUCAIAVYL3uAusFAAArwHrdBdYLAABWgPW6C6wXAACsAOt1F1gvAABYAdbrLrBeAACwAqzXXWC9AABgBVivu8B6AQDACrBed4H1AgCAFf4PlLvdcntFMhsAAAAASUVORK5CYII=" alt="" />
使用:
a. 不再是where Server=@Server, 而是 Server = ?。 问号按出现顺序和参数映射表中的参数名对应。
b. Ole db存储过程使用命名参数: exec xxx_sp @server=? @environment=?
3 动态脚本
如果想根据不同的情况,创建不同表或者将数据插入不同表,可以利用将Sql Task的Expressions中的SqlStatementSource绑定到动态语句,如
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAsIAAABgCAIAAACYO4NCAAASy0lEQVR4nO2dXY8UV36H61P4G/gDcI/kuUIoUl/shdfcIS4sV1BkKTYXWalNHC2W8lJBXsVI0LIvbLN0bAViWitCpC0cFKAh3uw2FuNMxxhcYDvTzIB7eoZZmGFycvEPR8d1Xrq6p+jqoZ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ih2RQ2AhyIjai6FgAAMO1gI8ABNgIAAIqAjQAH2AgAACjChGyEL//nSaV8UVMCNgIAAIqAjcBGOMBGAABAEbAR2AgH2AgAACgCNgIb4QAbAQAARZhRG3Fg/z5sRABsBAAAFGHSNiL3vG5sxHSCjQAAgCJUYCOqsg7PWqV8UVMCNgIAAIpQvY1onDh67cp52b544WzjxFGJdu3K+QP790VR9Mu/+gsz+cULZ/fumdu7Z04nj6LowP59t2/+TkJ0Ql2WHWJW49TJ43v3zEVRJEXbBenq2flgIwAAYJap3kYs9xbEKCzMX9GOwRzUGyeO6u3cYP/Z6Q/l4/lzn7x79IgE7t0ztzB/xczfDtHV+Oz0hzqhs6Dz5z7RV0DsfLARAAAwy0zF2oiF+SunTh4/sH+fHqSjKNKzCzJ+O8PNSQid2949c+fPfZKzEbkQHdnM4fbN35kF2ZHtfLARAAAwy0zFbERuJsCO5rwYETAlb75x0DQldkggw4CNsPPBRgAAwCwzFTZiYf7Kgf37GieO2sO8TBLoywq55HrywNa1K+dze80Qc4LBnI1wFpQr1M4ZGwEAALPJVNiIN984KAbCuTbizTcOfnb6Q2dycw5Db0jkhfkrerC3Q3Q+p04eN9dGOAsyF1Lk8sFGAADALFP92ojGiaMXL5zVJ/r6Tg25USKKolMnjwdcyLtHj0RRtHfPnM7k1Mnjcu+GvsPCDjHzkXs9AgWZniOXDzYCAABmmSl9iuVOfLxEKV/UlICNAACAImAjsBEOsBEAAFAEbAQ2wgE2AgAAijClNmInqpQvakrARgAAQBGwEdgIB9gIAAAoAjYCG+EAGwEAAEWYkI2AnQU2AgAAiiA24v8Ash1zh3YiST0AAAAASUVORK5CYII=" alt="" />
表达式填写为:
"create table [dbo].["+@[User::TargetTable]+"] ..."
这样,sql task的sql语句,将根据你的表达式动态生成,你可以充分利用变量增加程序的灵活性。
如果同一语句在一个package中出现多次,你还可以直接将该语句绑定到EvaluateAsExpression为true的一个新变量中,然后将新变量绑定到整个SqlStatementSource属性中。
4 Foreach Loop 的一个小Bug
最开始的时候,ForeachLoop的选项出现在File上,但下面的编辑界面显示不正确。需要改变下选项再改回File。