Tech Tip: TRUNCATE TABLE can bypass triggers
PRODUCT: 4D Developer | VERSION: 11.2 | PLATFORM: Mac & Win
Published On: November 20, 2008
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
For a table, Table_1, which is set up to trigger code on deleting a record, how can you quickly delete all records from the table while bypassing the trigger? By using the TRUNCATE TABLE command, new as of 4D v11 SQL Release 2:
It is similar to issuing the following commands:
But TRUNCATE TABLE will not cause the on delete trigger to run. Also note that referential integrity of the data is not checked, so it should be used carefully.