Azure Data Explorer 根据两列创建新列。

huangapple go评论86阅读模式
英文:

Azure Data Explorer Create a new column based on 2 columns

问题

我有一个Azure数据资源管理器中的表格,我想要一个新的字符串列,该列是两个字符串列连接的结果。

在KQL中,我可以使用extendstrcat函数来完成,但我希望该列成为表格数据的一部分,而不仅仅是一个虚拟列:

TableName
| extend NewCol=strcat(Col1,"separator",Col2)

以上操作将确实创建一个新列,并且该列的值是我想要的,但不会作为表格中的新列存储,这正是我想要的。

在SQL中可以像这样做:

ALTER TABLE Employees ADD FullName AS (FirstName + ' ' + LastName)
英文:

I have a table in Azure Data Explorer and I want to have a new string column that is the result of the concatenation of 2 string columns.

In KQL I can do it by using extend and strcat functions but I want the column to be part of the table data not just a virtual column:

TableName
| extend NewCol=strcat(Col1,"separator",Col2)

Doing the above will indeed create a new column and the value I want for the column but will not be stored as a new column in the table which is what I want.

Something like this in SQL:

ALTER TABLE Employees ADD FullName AS (FirstName + ' ' + LastName)

答案1

得分: 2

你无法将数据注入到已存在记录中的新列中(在该列添加到表之前已进行数据摄取的记录)。

为了在摄取时填充一个计算列,你可以使用更新策略。

参见:

英文:

you can't ingest data into a new column in existing records (that were ingested before the column was added to the table).

in order to populate a calculated column at ingestion time, you can use an update policy.

see:

huangapple
  • 本文由 发表于 2023年6月30日 04:39:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/76584475.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定