SSIS 优先约束 - 带有 AND 的表达式

Posted

技术标签:

【中文标题】SSIS 优先约束 - 带有 AND 的表达式【英文标题】:SSIS precedence constraint - expression with AND 【发布时间】:2021-01-20 17:28:50 【问题描述】:

我正在使用 Visual Studio 2019 和 SQL Server SSIS。

在优先约束中,如何在表达式中使用AND

例如,如果我有:

@myVariable1 == 0 AND @myVariable2 == 0

我收到消息

表达式无法计算

这就是我想要达到的目标:

我知道双管道运算符是一个逻辑ORAND 有类似的东西吗?

【问题讨论】:

【参考方案1】:

你需要像这样使用&&

@myVariable1 == 0 && @myVariable2 == 0

这里是 SSIS 表达式运算符的完整列表:

Operator Description
Cast Converts an expression from one data type to a different data type.
() (Parentheses) Identifies the evaluation order of expressions.
+ (Add) (SSIS) Adds two numeric expressions.
+ (Concatenate) Concatenates two expressions.
- (Subtract) Subtracts the second numeric expression from the first one.
- (Negate) Negates a numeric expression.
* (Multiply) Multiplies two numeric expressions.
/ (Divide) Divides the first numeric expression by the second one.
% (Modulo) Provides the integer remainder after dividing the first numeric expression by the second one.
|| (Logical OR) Performs a logical OR operation.
&& (Logical AND) Performs a logical AND operation.
! (Logical NOT) Negates a Boolean operand.
| (Bitwise Inclusive OR) Performs a bitwise OR operation of two integer values.
^ (Bitwise Exclusive OR) Performs a bitwise exclusive OR operation of two integer values.
& (Bitwise AND) Performs a bitwise AND operation of two integer values.
~ (Bitwise NOT) Performs a bitwise negation of an integer.
== (Equal) Performs a comparison to determine if two expressions are equal.
!= (Unequal) Performs a comparison to determine if two expressions are not equal.
> (Greater Than) Performs a comparison to determine if the first expression is greater than the second one.
< (Less Than) Performs a comparison to determine if the first expression is less than the second one.
>= (Greater Than or Equal To) Performs a comparison to determine if the first expression is greater than or equal to the second one.
<= (Less Than or Equal To) Performs a comparison to determine if the first expression is less than or equal to the second one.
? : (Conditional) Returns one of two expressions based on the evaluation of a Boolean expression.

【讨论】:

以上是关于SSIS 优先约束 - 带有 AND 的表达式的主要内容,如果未能解决你的问题,请参考以下文章

SSIS – 变量和表达式

如何在ssis表达式语言中进行格式表达

SSIS 表达式无法验证

如果条件不满足,派生列表达式SSIS如何忽略表达式?

SSIS 变量“变量”的表达式评估失败。表达式中有错误

SSIS 表达式构建