SSIS - 使用变量替换动态SQL

时间:2015-12-21 11:43:21

标签: ssis

在我的数据流任务中,我有OLEDB Source并带有以下查询:

SELECT  am.Code AS MeterCode
       ,am.Code AS NewMeterCode
       ,am.Description AS NewMeterDescription
       ,mr.TagName
       ,mr.RunHours
       ,mr.DateTo AS DateRead
FROM    [19-AIS-004\VIJEOHISTORIAN].VijeoHistorianCPSData.dbo.RunHours AS mr
        INNER JOIN dbo.astMeters AS am ON mr.TagName COLLATE SQL_Latin1_General_CP1_CI_AS = am.Code

表' mr'是链接的服务器表,我获取了Tagname,Runhours和DateTo并将其与astMeters表连接,以便将数据从mr表导入到am table。 我的问题是因为包通过vpn部署在远程服务器中我需要一种方法,我可以为这个表创建字符串参数' [19-AIS-004 \ VIJEOHISTORIAN] .VijeoHistorianCPSData.dbo.RunHours' 。

1 个答案:

答案 0 :(得分:0)

将整个查询构建为SSIS字符串变量,并在OLEDB源中,选择SQL Query From Variable并选择包含查询的字符串变量。