Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ALTER TABLE tbl AUTO_INCREMENT = 123 as codeigniter active records query?

How to execute

ALTER TABLE tblname AUTO_INCREMENT = 123

as codeigniter active records query?

There is something called dbforge->modify_column() in codeigniter , do i have to use that, if so how?

like image 301
Learner_Programmer Avatar asked Feb 06 '14 06:02

Learner_Programmer


1 Answers

try this

$this->db->query("ALTER TABLE table_name AUTO_INCREMENT 1");

change value after AUTO_INCREMENT where you want to start auto increment value from like this

$this->db->query("ALTER TABLE table_name AUTO_INCREMENT 12");

Alter table operation called DDL Data Defination Language where you execute queries at database not at data.

like image 177
user2727841 Avatar answered Sep 25 '22 13:09

user2727841