SQL Error = (226) TRUNCATE TABLE command not allowed within multi-statement transaction.

The below error was came up when one of my colleague was trying to truncate a table with in an SQR procedure. I don’t know whether this is a Sybase specific or for all the databases.

SQL Error  = (226) TRUNCATE TABLE command not allowed within multi-statement transaction.
The Solution is to COMMIT before and after the truncate table statement, So that this will commit the previous transactions.

Example:

Before:

TRUNACATE TABLE PS_CUSTOMER_TMP;

After:

COMMIT;
TRUNACATE TABLE PS_CUSTOMER_TMP;
COMMIT;

One Response to “SQL Error = (226) TRUNCATE TABLE command not allowed within multi-statement transaction.”

  1. Just a little notice :

    TRUNACATE -> TRUNCATE

Leave a Reply

You must be logged in to post a comment.