Hi guys,
In one of my code, I want to delete my custom table, but somehow while in the middle of process, when I do debugging, the table has not being deleted.
I'm using this kind of syntax:
MY_PaymentGroupTmp recPaymGroupPayDel; ttsbegin; delete_from recPaymGroupPayDel; ttscommit;
While I debug this, after passed ttscommit, then checking in SSMS, the data still there. Ain't "delete_from" will delete all the records in the specified table ?
Anything that I missed ?
Thanks,
Hi Axel,
Are you trying to apply this coding on an in-memory temporary table? The delete_from statement is to optimize performance for deleting records form a database table. Clearing the memory can be done with the next statement.
recPaymGroupPayDel = null;
Hi, Your code looks fine, the issue might be in method calling this one like ttsbegin and ttscommit in caller. Also, you don't need ttsBegin & ttsCommit in Delete_From. To confirm, I have tested it by creating new table and runnable class.
Hello Axel,
You might want to add the condition where.
MY_PaymentGroupTmp recPaymGroupPayDel; ttsbegin; delete_from recPaymGroupPayDel where recPaymGroupPayDel.recid !=0; ttscommit;
hi
Yes, the delete_from statement should delete all the records from the specified table. However, the delete_from statement does not actually delete the records until a ttscommit statement is executed, which means that the deletion is not permanent until the transaction is committed.
So, if you have executed delete_from and then ttscommit, the records should be deleted permanently from the table. If you are still seeing the records in SSMS after executing delete_from and ttscommit, then there may be other factors at play, such as a delay in the data being reflected in SSMS or an issue with the code. You may want to double-check that the correct table name is being used and that there are no errors in the code that could be preventing the deletion from occurring.
DAniele
André Arnaud de Cal...
291,979
Super User 2025 Season 1
Martin Dráb
230,848
Most Valuable Professional
nmaenpaa
101,156