在SSIS内的查询中定义源和模式名称的占位符

时间:2014-03-04 02:40:00

标签: sql sql-server-2008 ssis sqldatasource

我在SSIS包的OLE DB源中使用了以下带有硬编码数据源名称的查询,我从中提取了某些类型的行。

select * 
from mtb.dbo.TRS_Trans_For_EY_Incl_Wire_Info_20131004 AS src 
where 'TRS-' + src.Transaction_Type_Cd 
NOT IN ( 
select dtp.trans_type_cd 
from mtb_etl.dbo.tb_transaction_type AS dtp
where dtp.cust_indicator = 'I')

我的问题是如何使用标准查询(而不是硬编码查询)来提取数据,使其适用于各种数据源?

1 个答案:

答案 0 :(得分:0)

尤里卡!!!我找到了它!

select * 
from [dbo].[TRS_Trans_For_EY_Incl_Wire_Info_20131004]  
where 'TRS-' + [Transaction_Type_Cd] 
NOT IN ( 
select [trans_type_cd] 
from [dbo].[tb_transaction_type] 
where [cust_indicator] = 'I')