.create table based-on
Creates a new empty table based on existing table. This command must run in the context of a specific database.
Requires Database admin permission.
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-oncommand, the current principal is added to the table admins.
Syntax
.create table TableName based-on OtherTable [with ([docstring = Documentation] [, folder = FolderName] )]
Arguments
- TableName: New table name
- OtherTable: Source table name
- Documentation: Override default table documentation string
- FolderName: Override target folder name
Returns
This command returns the new table's schema in JSON format, similar to running the following command:
.show table MyLogs schema as json
Example
.create table MyLogs_Temp based-on MyLogs with (folder="TempTables")