How to TRUNCATE SQLServer CE 3.5
SQLServer Compact Edition 3.5, does not support the truncate function supported by some other database servers like MS SQL Server ,mysql serever etc. so i decided, to do a little walk around and found a little piece of code that enables you do have with some considerable speed. Just follow this two step process and you are done.
SQLServer Compact Edition 3.5, does not support the truncate function supported by some other database servers like MS SQL Server ,mysql serever etc. so i decided, to do a little walk around and found a little piece of code that enables you do have with some considerable speed. Just follow this two step process and you are done.
- First Delete all columns in the database table. use the query :
DELETE FROM tablename;
where tablename is the name of your table.NOTE :your delete query do not need the where clause since you are deleting all rows in the table. - Add the query :
ALTER TABLE yourtablename ALTER COLUMN ID IDENITY(1,1)
and you should see your table reset to its initial status with no rows or identity.