我想将下面SSIS包中的转换器更改为SQL查询:
(TYPTRF ==“O”?(NUMCPT_ORD ==“4000328702”?“005000DY”:( ISNULL(NUMCLI_ORD)?“”:NUMCLI_ORD)):( NUMCPT_BEN ==“4000328702”?(ISNULL(NUMCLI_BEN_BAN)? “”:NUMCLI_BEN_BAN):( ISNULL(NUMCLI_BEN)?“”:NUMCLI_BEN)))
请帮帮我。我是SSIS的新手
感谢。
答案 0 :(得分:1)
SQL案例
CASE WHEN TYPTRF = 'O'
THEN CASE WHEN NUMCPT_ORD = '4000328702'
THEN '005000DY'
ELSE CASE WHEN NUMCLI_ORD is null
THEN ''
ELSE NUMCLI_ORD END
END
ELSE CASE WHEN NUMCPT_BEN = '4000328702'
THEN CASE WHEN NUMCLI_BEN_BAN is null
THEN ''
ELSE NUMCLI_BEN_BAN END
ELSE CASE WHEN NUMCLI_BEN is null
THEN ''
ELSE NUMCLI_BEN END
END
END
已修改(MS SQL):
CASE WHEN TYPTRF = 'O'
THEN CASE WHEN NUMCPT_ORD = '4000328702'
THEN '005000DY'
ELSE isnull(NUMCLI_ORD, '')
END
ELSE CASE WHEN NUMCPT_BEN = '4000328702'
THEN isnull(NUMCLI_BEN_BAN,'')
ELSE isnull(NUMCLI_BEN,'')
END
END
和Gareth说,你可以这样做:
CASE WHEN TYPTRF = 'O'
THEN CASE WHEN NUMCPT_ORD = '4000328702'
THEN '005000DY'
ELSE isnull(NUMCLI_ORD, '')
END WHEN NUMCPT_BEN = '4000328702'
THEN isnull(NUMCLI_BEN_BAN,'')
ELSE isnull(NUMCLI_BEN,'')
END
答案 1 :(得分:-1)
你需要大量案例陈述!
试试这个!
select case when TYPTRF='O' then NUMCPT_ORD='4000328702' else '005000DY' end,
case when ISNULL(NUMCLI_ORD)='' then 'NUMCLI_ORD' else end,
case when NUMCPT_BEN ='4000328702' then '' else NUMCLI_BEN_BAN end,
case when (ISNULL(NUMCLI_BEN)='' then '' else NUMCLI_BEN end