# Truncate table before loading?

**URL:** <https://forum.cloverdx.com/t/truncate-table-before-loading/584>\
**Category:** CloverDX Platform\
**Created:** [September 8, 2009, 12:00am UTC](https://forum.cloverdx.com/t/truncate-table-before-loading/584 "2009-09-08T00:00:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ciscochi](https://avatars.discourse-cdn.com/v4/letter/c/b5ac83/32.png) [@ciscochi](https://forum.cloverdx.com/u/ciscochi)\
**Post date:** [September 8, 2009, 12:00am UTC](https://forum.cloverdx.com/t/truncate-table-before-loading/584/1 "2009-09-08T00:00:00Z")

</div>

How can I truncate a table before loading?

I’ve tried the following:

1. add a truncate table statement to DBOutputTable followed by an insert
2. add a delete statement to DBOutputTable followed by an insert

I also don’t see anything in the component property to perform this operation.

For some context, I like to load my data into an empty staging table before loading into the target with an insert or upsert. Now that I think of it, I’m not sure I can do this in Clover.

Any guidance?

Thanks.

---

<div class="post-metadata">

**Author:** ![avackova](https://avatars.discourse-cdn.com/v4/letter/a/65b543/32.png) [@avackova](https://forum.cloverdx.com/u/avackova)\
**Post date:** [September 9, 2009, 7:48am UTC](https://forum.cloverdx.com/t/truncate-table-before-loading/584/2 "2009-09-09T07:48:38Z")

</div>

Hello CiscoChi,  
for “static” statements, like _truncate table_ or _create table_, you should use [DBExecute component](http://wiki.cloveretl.org/doku.php?id=components:others#db%5Fexecute). Create graph, which in the first phase truncates your database table and in the next phases does the rest of your transformation (see example extExamples/graph/graphDBLoad5.grf from our examples: [cloverETL.examples.rel-2-8-0.zip](http://sourceforge.net/projects/cloveretl/files/cloveretl.engine/rel-2-8-0/cloverETL.examples.rel-2-8-0.zip/download))

---

<div class="post-metadata">

**Author:** ![ciscochi](https://avatars.discourse-cdn.com/v4/letter/c/b5ac83/32.png) [@ciscochi](https://forum.cloverdx.com/u/ciscochi)\
**Post date:** [September 9, 2009, 4:56pm UTC](https://forum.cloverdx.com/t/truncate-table-before-loading/584/3 "2009-09-09T16:56:35Z")

</div>

Thanks!

I found DBExecute after I posted. This works for me.
