TRUNCATE statement in SQL is a – code example
Example 1: sql truncate table
-- Quick, no possible rollback
TRUNCATE TABLE my_table;
-- With rollback
DELETE FROM my_table;
COMMIT;
Example 2: sql truncate number
-- Truncate number with cast
UPDATE my_table
SET my_column = CAST(my_column AS INT)
WHERE ...;
-- or convert
UPDATE my_table
SET my_column = CONVERT(INT, my_column)
WHERE ...;