column_names_of()

Applies to: ✅ Azure Data ExplorerAzure MonitorMicrosoft Sentinel

Returns the column names of a tabular expression.

Syntax

column_names_of(expression)

Parameters

Name Type Required Description
expression expression ✔️ The tabular expression to evaluate.

Returns

Returns a dynamic array of strings, where each element represents a column name of the expression schema. If the expression doesn't exist, an error is raised.

Examples

Example 1: Get column names from a datatable

The following example returns the columns of the tabular expression T. T can be a table in the database or defined with a let statement.

let T = datatable(A:string, B:int) [];
print Columns=column_names_of(T)

Output:

Columns
[
"A",
"B"
]

Example 2: Get column names from a function

Similarly, you can call column_names_of() with functions:

let MyFunction1 = () { print A="", B=1 };
print Columns=column_names_of(MyFunction1())

Output:

Columns
[
"A",
"B"
]

Example 3: Get column names from a function with parameters

If the function has arguments, they can be used when calling column_names_of():

let MyFunction1 = (param1:int) { print A="", B=1 };
print Columns=column_names_of(MyFunction1(1))

Output:

Columns
[
"A",
"B"
]