sql语句如何实现插入不重复的20位字符串(mysql)?
程序员文章站
2022-11-02 18:09:39
#md5截取15位
delimiter @
DROP PROCEDURE IF EXISTS insert_Table;
create procedure insert_Ta...
#md5截取15位
delimiter @
DROP PROCEDURE IF EXISTS insert_Table;
create procedure insert_Table(in item integer)
begin
declare counter int;
set counter = item;
while counter >= 0 do
insert into name(uid,name) values(counter, UPPER(concat('ABCDE',LEFT(md5(counter),15))) );
set counter = counter - 1;
end while;
end
@
delimiter @
call insert_Table(1000000);
@