We are created SQL notebook in Databricks and we are trying to develop onetime script. we have to truncate and load the data every time and the table sequence id generated always start with 1. if we do truncate and load the data. the sequence of id taking last insert value, means not able to restart 1. how do we restart 1 value if we try to insert the data after truncate command.
actual table created,
CREATE TABLE IF NOT EXISTS schema.tablename(
SerialNo BIGINT GENERATED ALWAYS AS IDENTITY (START WITH 1 INCREMENT BY 1) COMMENT "SerialNo - auto generated sequence id",
adlsSourceMountPath STRING COMMENT "location",
adlsTargetMountPath STRING COMMENT "location",
tableSchemaName STRING COMMENT "tableSchemaName - adls target delta table schema name",
DescriptionDetails STRING COMMENT "DescriptionDetails",
CreateDate DATE COMMENT "CreateDate - generate current date",
Active BOOLEAN COMMENT "Active - check active status of connections"
)USING DELTA
LOCATION "location/path"
COMMENT "descri"
we tried below command but throwing error.
TRUNCAT TABLE TABLENAME RESTART IDENTITY;
please suggest.