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.
In this article
Applies to: ✅ Azure Data Explorer
Creates a new empty table based on an existing table. This command must run in the context of a specific database.
Note
All properties of the source table are copied to the new table, with the following exceptions:
- Update policy
- Authorized principals: When using the
.create table based-on
command, the current principal is added to the table admins.
You must have at least Database Admin permissions to run this command.
.create
table
tableName based-on
otherTable [ifnotexists
] [with
(
propertyName =
propertyValue [,
...])
]
Learn more about syntax conventions.
Name | Type | Required | Description |
---|---|---|---|
ifnotexists |
string |
If specified, the table will only be created if it doesn't already exist. | |
tableName | string |
✔️ | The name of the table to create. The case-senestive name must be unique in the database. |
otherTable | string |
✔️ | The name of an existing table to use as the source for the columns, docstring, and folder of the table being created. |
propertyName, propertyValue | string |
A comma-separated list of key-value property pairs. See 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. The default value is Created based on <tableName>. |
folder |
string |
The name of the folder where to add the table. The default is the same folder as tableName. |
This command returns the new table's schema in JSON format, similar to running the following command:
.show table MyLogs schema as json
Note
- If the table already exists:
- If
ifnotexists
flag is specified, the command is ignored (no change applied). - If
ifnotexists
flag is NOT specified, an error is returned.
- If
.create table MyLogs_Temp based-on MyLogs with (folder="TempTables")