Deleting All records of a DB table

Posted by dhullp on 14-Oct-2010 05:16

Is there any way to delete the All records of a DB table which is something similar to EMPTY temp table?

I could not find any such method/statement.

I would appreciate response if anyone have tried any way, basically I want to delete all records from few of the tables.

All Replies

Posted by Admin on 14-Oct-2010 05:18

DELETE FROM .

Posted by dhullp on 14-Oct-2010 05:44

Hello Mike,

Thank you for your prompt response.

Does it have the same impact in terms of growing size as the Normal "for each

:.... Delete . End". have?

Posted by Admin on 14-Oct-2010 06:03

Yes it will cause the BI file to grow.

It's still better than the FOR EACH as it does not require an ABL loop and so will be (slightly) faster. The fastest way is to drop the table and reload it. Using DDL. But that requires a schema lock and so is not suitable for runtime.

Posted by dhullp on 14-Oct-2010 06:49

Thanks Mike.

Posted by Thomas Mercer-Hursh on 14-Oct-2010 11:38

If this is a recurring requirement, rather than a one-time deal, you might consider putting this table in its own database.  Then you can "empty" the table simply by deleting the existing database and copying in an embty copy.

Posted by dhullp on 14-Oct-2010 11:51

Thanks.

This thread is closed