Friday, July 30, 2010

Clearing a table: the fast way

Just something that can be handy: if you have to clear a table , I always used the following statement before

   1:  DELETE FROM TABLE

Now if you have a table with a large amount of records, this can take a long time. A lot faster way is to use the following SQL statement instead:

   1:  TRUNCATE TABLE

Remark: This is only for SQL Server. I have no idea if this is also true for other database systems.

No comments: