CREATE TABLE AS CLONE OF
Applies to: Warehouse in Microsoft Fabric
Creates a new table as a zero-copy clone of another table in Warehouse in Microsoft Fabric. Only the metadata of the table is copied. The underlying data of the table, stored as parquet files, is not copied.
For more information on cloning a table in Microsoft Fabric, see Clone table with TSQL in Microsoft Fabric. You can also clone tables in Microsoft Fabric via the Fabric portal, for examples see Clone tables in the Fabric portal.
Transact-SQL syntax conventions
CREATE TABLE
{ database_name.schema_name.table_name | schema_name.table_name | table_name }
AS CLONE OF
{ database_name.schema_name.table_name | schema_name.table_name | table_name } [AT {point_in_time}]
The name of the database that will contain the new cloned table. The default is the current database.
The schema of the table where the table clone is located. Specifying schema is optional when table is cloned within the same schema. If blank, the default schema is used.
Providing the schema name is required when a table is cloned across schemas.
The name of the cloned table. Table names must follow the rules for identifiers. table_name can be a maximum of 128 characters.
At the date and time provided, the table clone accurately mirrors the data as it was at that particular date and time in UTC. The format of the datetime data type value must be 'YYYY-MM-DDThh:mm:ss', where 'T' indicates the start of time.
Specifying the point_in_time is not required for creating table clones as of current point in time.
Warehouse automatically preserves and maintains the data history for seven calendar days. For more information, visit Clone table.
Requires:
- SELECT permission on the entire source table
- CREATE TABLE permissions on the schema in which the clone of the table will be created
Primary and unique key constraints defined in the source table are replicated when creating a clone.
For limitations, see Clone table limitations.
--Clone creation within the same schema
CREATE TABLE dbo.Employee AS CLONE OF dbo.EmployeeUSA;
--Clone creation across schemas
CREATE TABLE dbo.Employee AS CLONE OF dbo1.EmployeeUSA;
--Clone creation within the same schema
CREATE TABLE dbo.Employee AS CLONE OF dbo.EmployeeUSA AT '2023-05-23T14:24:10.325';
--Clone creation within the same schema
CREATE TABLE dbo.Employee AS CLONE OF dbo1.EmployeeUSA AT '2023-05-23T14:24:10';