[英]Time function in Azure Data Factory - Expression Builder
I only need to take the time part from the 'Timestamp type source attribute' and load it into a dedicated SQL pool table (Time datatype column).我只需要从“时间戳类型源属性”中提取时间部分并将其加载到专用的 SQL 池表(时间数据类型列)中。 But I don't find a time function within the expression builder in ADF, is there a way I can do it?
但是我在 ADF 的表达式生成器中找不到时间 function,有什么办法可以做到吗?
-What did I do? -我做了什么? -I took the time part from the source attribute using substring and then tried to load the same into the destination table, when I do the destination table inserted null values as the column at the destination table is set to time datatype.
-我使用 ZE83AED3DDF4667DEC0DAAAACB2BB3BE0BZ 从源属性中获取时间部分,然后尝试将其加载到目标表中,当我在目标表中插入 null 值时,因为目标表中的列设置为时间数据类型。
I tried to reproduce this and got the same issue.我试图重现这一点并遇到了同样的问题。 The following is a demonstration of the same.
以下是相同的演示。 I have a table called
mydemo
as shown below.我有一个名为
mydemo
的表,如下所示。
CREATE TABLE [dbo].[mydemo]
(
id int NOT NULL,
my_date date,
my_time time
)
WITH
(
DISTRIBUTION = HASH (id),
CLUSTERED COLUMNSTORE INDEX
)
GO
The following is my source data in my dataflow.以下是我的数据流中的源数据。
time
is not a recognized datatype in azure dataflow ( date and timestamp
are accepted). time
不是 azure 数据流中可识别的数据类型(接受date and timestamp
)。 Therefore, dataflow fails to convert string
( @substring(<timestamp_col>,12,5) ) into time
type.string
( @substring(<timestamp_col>,12,5) ) 转换为time
类型。1900-01-01 12:34:56
when time value in the table row is 12:34:56
.1900-01-01 12:34:56
12:34:56
。#my table row
insert into mydemo values(200,'2022-08-18','12:34:56')
substring(<timestamp_col>,12,5)
to return 00:01 , use concat('1900-01-01 ',substring(<timestamp_col>,12,8))
which returns 1900-01-01 00:01:00 .substring(<timestamp_col>,12,5)
返回00:01 ,而是使用concat('1900-01-01 ',substring(<timestamp_col>,12,8))
返回1900-01-01 00:01:00 。 data preview
.data preview
中查看生成的数据。 Now, azure dataflow will be able to successfully insert the values and give desired results. NOTE: You can construct valid yyyy-MM-dd hh:mm:ss
as a value using concat('1900-01-01 ',substring(<timestamp_col>,12,8)) in place of 1900-01-01 hh:mm:ss
in derived column transformation
.注意:您可以使用 concat('1900-01-01 ',substring(<timestamp_col>,12,8)) 代替
1900-01-01 hh:mm:ss
构造有效yyyy-MM-dd hh:mm:ss
作为值1900-01-01 hh:mm:ss
在derived column transformation
中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.