mysql sequence 模拟
# 创建表
drop table aaa;
create table aaa(id int,userid varchar(200),primary key (id)) ENGINE=InnoDB DEFAULT CHARSET=utf8;
## 存储过程造数
drop procedure if exists testinsert;
delimiter //
create procedure testinsert()
begin
declare i int default 0;
while i < 90
do
start transaction;
insert into aaa set id=i , userid=(select concat((select DATE_FORMAT(now(),'%Y%m%d')),(select lpad(i,6,0))));
select sleep(1);
commit;
set i=i+1;
end while;
end//
delimiter ;
call testinsert();
select * from aaa;