Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to: ✅ Azure Data Explorer ✅ Azure Monitor ✅ Microsoft Sentinel
Creates a table whose schema and values are defined in the query itself.
Note
This operator doesn't have a pipeline input.
Syntax
datatable( ColumnName : ColumnType [, ...]) [ ScalarValue [, ...] ]
Learn more about syntax conventions.
Parameters
| Name | Type | Required | Description | 
|---|---|---|---|
| ColumnName | string | 
✔️ | The name for a column. | 
| ColumnType | string | 
✔️ | The type of data in the column. | 
| ScalarValue | scalar | ✔️ | The value to insert into the table. The total number of values must be a multiple of the number of columns in the table. Each value is assigned to a column based on its position. Specifically, the n'th value is assigned to the column at position n % NumColumns, where NumColumns is the total number of columns. | 
Note
The column name and column value pairs define the schema for the table.
Returns
Returns a data table of the given schema and data.
Examples
The following example creates a table with Date, Event, and MoreData columns, filters rows with Event descriptions longer than 4 characters, and adds a new column key2 to each row from the MoreData dynamic object.
datatable(Date:datetime, Event:string, MoreData:dynamic) [
    datetime(1910-06-11), "Born", dynamic({"key1":"value1", "key2":"value2"}),
    datetime(1930-01-01), "Enters Ecole Navale", dynamic({"key1":"value3", "key2":"value4"}),
    datetime(1953-01-01), "Published first book", dynamic({"key1":"value5", "key2":"value6"}),
    datetime(1997-06-25), "Died", dynamic({"key1":"value7", "key2":"value8"}),
]
| where strlen(Event) > 4
| extend key2 = MoreData.key2
Output
| Date | Event | MoreData | key2 | 
|---|---|---|---|
| 1930-01-01 00:00:00.0000000 | Enters Ecole Navale | { "key1": "value3", "key2": "value4" }  | 
value4 | 
| 1953-01-01 00:00:00.0000000 | Published first book | { "key1": "value5", "key2": "value6" }  | 
value6 |