问题描述
这是一个SQL Server Integration Services(SSIS)表达式问题(对此我很陌生).
This is a SQL Server Integration Services (SSIS) expressions question (I'm pretty new to it).
我想在派生列"转换中编写一个switch/case表达式-基本上,新列可以基于输入列的值具有5个不同的可能值.我从Google那里得到的只是(条件)? (真值):(假值)技术,但这仅提供两个可能的值. SSIS表达式是否具有switch/case类型的表达式?
I would like to write a switch/case expression in a Derived Column transform - basically the new column can have 5 different possible values, based on the value of an input column. All I got from Google is the (condition) ? (true value) : (false value) technique, but this only provides for two possible values. Does SSIS expressions have a switch/case type expression?
我曾考虑过使用顺序的派生列"转换,或创建一个临时的查找表,但这似乎比它本来应该更复杂.
I thought of using sequential Derived Column transforms, or creating a temporary lookup table, but that just seems more complicated that it really should be.
谢谢.
推荐答案
我使用了等效的if-elseif-else语句来解决该问题,如下所示:
I have used the equivalent of a if-elseif-else statement to solve the problem, like this:
(condition1)? (真值1):(条件2)? (true value2):( false值)
(condition1) ? (true value1) : (condition2) ? (true value2) : (false value)
这篇关于如何编写SSIS开关/大小写表达式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!