SQl queries problem

SQl queries problem

  

Hi all!

When I execute an sql inside a server action in my mobile module I get the following error: Incorrect syntax near '*'.

The query is as follows: DELETE * FROM {myentity}.

p.s.

My main goal is to truncate myentity e.g. delete everything and set the ID field to 1.

Any help is appreciated.


Solution

Hi Manvel,

Did you try only DELETE FROM {myentity}?

Cheers,
Eduardo Jauch

Solution

Eduardo Jauch wrote:

Hi Manvel,

Did you try only DELETE FROM {myentity}?

Cheers,
Eduardo Jauch


Thank you for your quick reply(it worked).

But how can I reset the ID to 1?

Hello Manvel,

The only way to "reset" id to 1 again is to copy the entity (creating a new one), deleting the old and than renaming the new entity to have the old entity's name.

When you do this, you in fact are creating a NEW table in database, and the id will be set to 1 in the new table.

But the platform will not delete the old table. To do that, you can use an app like DbCleaner (from forge).

Cheers,
Eduardo Jauch

Thank You!

I love Outsystem community :)