Bewerken

Delen via


.create table command

Applies to: ✅ Microsoft FabricAzure Data Explorer

Creates a new empty table.

The command must run in the context of a specific database.

Permissions

You must have at least Database User permissions to run this command.

Syntax

.create table tableName (columnName:columnType [, ...]) [with (propertyName = propertyValue [, ...])]

Learn more about syntax conventions.

Parameters

Name Type Required Description
tableName string ✔️ The name of the table to create.
columnName, columnType string ✔️ The name of a column mapped to the type of data in that column. The list of these mappings defines the output column schema.
propertyName, propertyValue string A comma-separated list of key-value property pairs. See supported properties.

Supported properties

Name Type Description
docstring string Free text describing the entity to be added. This string is presented in various UX settings next to the entity names.
folder string The name of the folder to add to the table.

Note

If a table with the same (case-sensitive) name already exists in the context of the database, the command returns success without changing the existing table, even in the following scenarios:

  • The specified schema doesn't match the schema of the existing table
  • The folder or docstring parameters are specified with values different from the ones set in the table

Example

.create table MyLogs ( Level:string, Timestamp:datetime, UserId:string, TraceId:string, Message:string, ProcessId:int32 ) 

Output

Returns the table's schema in JSON format, same as:

.show table MyLogs schema as json

Note

For creating multiple tables, use the .create tables command for better performance and lower data load.