你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
column_ifexists()
Applies to: ✅ Microsoft Fabric ✅ Azure Data Explorer ✅ Azure Monitor ✅ Microsoft Sentinel
Takes a column name as a string and a default value. Returns a reference to the column if it exists, otherwise - returns the default value.
Deprecated aliases: columnifexists()
Syntax
column_ifexists(
columnName,
defaultValue)
Learn more about syntax conventions.
Parameters
Name | Type | Required | Description |
---|---|---|---|
columnName | string |
✔️ | The name of the column to check if exists. |
defaultValue | scalar | ✔️ | The value to use if the column doesn't exist. This value can be any scalar expression. For example, a reference to another column. |
Returns
If columnName exists, then the column it refers to. Otherwise defaultValue.
Example
// There's no column "Capital" in "StormEvents", therefore, the State column will be used instead
StormEvents | project column_ifexists("Capital", State)