Toad World® Forums

Reset initial autoincremtn tof all entities to 0


#1

I am trying to generate a ddl script and want to re-initialize my tables but I can't find an easy way to set all the tables'/entities' auto increment back to zero?


#2

Hi jlaurence,

I suppose it's a MySQL database.
You can use the Scripting Window (required Expert Mode)
and you can insert following script:

for (var i = 0; i < Model.Entities.Count; i++)
{
  var Entity = Model.Entities.GetObject(i);
  Entity.InitAutoIncr = "0";      
}

Result - the InitAutoIncr property is set to 0 for all entities.

Best regards
Petr


#3

That should work thanks!