英文:
Azure Data Explorer Create a new column based on 2 columns
问题
我有一个Azure数据资源管理器中的表格,我想要一个新的字符串列,该列是两个字符串列连接的结果。
在KQL中,我可以使用extend和strcat函数来完成,但我希望该列成为表格数据的一部分,而不仅仅是一个虚拟列:
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:
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论