日期的 Azure 数据工厂案例条件

Azure Data Factory Case Condition for date

我在 Azure Blob 存储的 txt 文件中有列日期,如下所示:

00000000
00000000
20120104
00000000
20111122
00000000

20120104 表示 2012-01-04。

我必须使用派生列转换此列并使用一些逻辑:IF 00000000 然后更改为 NULL。我在派生列中有这样的表达式:

iif({Entry Date} == '00000000', toString(null()), coalesce(toDate({Entry Date},'yyyyMMdd')))

或者我试试

iif({Entry Date} == '00000000', toString(null()), coalesce(soString(toDate({Entry Date},'yyyyMMdd'))))

但是在数据审查之后,结果一切都是空的。非常感谢回答问题。谢谢,

您还可以在派生列中使用 case() 表达式,如下所示

case(toString(date)=='0', toString(null()),concat(substring(toString(date),1,4),'-', substring(toString(date),5,2),'-', substring(toString(date),7,2)))