Reordenar (Reorder) primary key auto_increment mysql

mysql_query("ALTER TABLE tabla DROP id");
mysql_query("ALTER TABLE tabla AUTO_INCREMENT = 1");
mysql_query("ALTER TABLE tabla ADD id bigint UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST");

Hasta la próxima.


2 Comments on “Reordenar (Reorder) primary key auto_increment mysql”

  1. Benja says:

    Buenísimo!
    Me salvaste la tarde.
    Gracias.

  2. sandaruwan says:

    Gracias.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s