带有两个值的 SQL/Informatica 中的 IIF 语句(表达式转换)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35181534/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 04:24:21  来源:igfitidea点击:

IIF statement in SQL/ Informatica ( expression transformation) with two values

sqlinformaticaiif

提问by Nidhin_toms

I have the following SQL statement which check for the presence of 000. But what if I want to check the presence of either 000 or 666? I tried using | but no luck.....

我有以下 SQL 语句来检查 000 是否存在。但是如果我想检查 000 或 666 是否存在怎么办?我尝试使用 | 但没有运气.....

IIF(Field='000','TRUE','FALSE')

回答by Vamsi Prabhala

Use in.

使用in.

IIF(Field in ('000','666'),'TRUE','FALSE')

回答by sagi

What dbms are you using?

你用的是什么数据库?

Anyways, I'll suggest CASE instead of iif and IN instead of || like this:

无论如何,我会建议 CASE 而不是 iif 和 IN 而不是 || 像这样:

SELECT CASE WHEN Field in('000','666') then 'TRUE' else 'FALSE' end as Col1
FROM YourTable

EDIT:

编辑:

For informatica, there are 1 of two options, Either use OR like this:

对于 informatica,有两个选项之一,或者像这样使用 OR:

IIF(Field='000' or Field='666','TRUE','FALSE')

Or use IN like this:

或者像这样使用 IN:

IIF(Field in('000','666'),'TRUE','FALSE')