How to reset table ID ?
Application Type


Please how can i reset my table ID after have deleted all the records ?

I tried to delete the table but some errors appears due to the database relationship and the behavior still very weird so i don't think is a good solution.



Your problem is on the ID, where don't let you delete the table? if so, you must change the delete rule of the property's property ID to ignore(if you want to keep the data) or delete(if you want to remove).

Can you give more details?


Márcio C.

I can delete the table BUT i can't reset the ID increment to zero.

Try this, I dunno if it will work but I already saw it in some cases. Try to change the name of the ID and publish, and then put again as ID and publish again and tell me if the ID is at zero now.

The table you are using as references to other tables?


If your user have permissions, you can use a TRUNCATE statement.



I tried with SQL test but it not works. Error :


Hi Julien,

you'll probably have to do this directly on SQL Server.

Please check the delete rule property of entity, then fire Truncate command in SQL.


Hello Julian 

To delete the data from Entity... first look into the Entity Delete Rule and it should be Ignore (If you want to delete the data anyhow and "Ignore" will keep the relative data in other tables.)

Then try to delete the rows or use  TRUNCATE TABLE {EntityName}; direct in SQL

This might work for you :)

Hi @Julien Garcia,

To reset a table primary key auto number you need to truncate the table.

SQL Server -

Oracle -


Guys, the table trunc only works on on-premise with enough permissions. In OutSystems hosted cloud environments you will never have sufficient database permissions to do this.

One option you have is to cut paste the entity in your module. This will generate a new table in the database.

With a search on the forum you would have find this answer probably multiple times.

Hello julien, 

if above any thing is not working than you direct cut and paste the your Entity(which you want to nullify). So it is automatically truncate the data and you will see the id start from zero.


AKshay Deshpande.


"if above any thing is not working" then your suggestion is also not working, as I already suggested it 3 days ago. :)

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.