sábado, 22 de outubro de 2022

SQL Calcular token automaticamente

-- select substring(sha1(rand()),1,40);

substring(sha1(rand()),1,40);


BEGIN

declare token tinytext;

declare s tinytext default 'abcdefghijklmnopqrstuvxzABCDEFGHIJKLMNOPQRSTUVXZ1234567890_';

declare n int;

set token='';


while length(token)<=40 do

set n=rand()*61;

set token=concat(token,substr(s,n,1));

end While;

select token;

END

Sem comentários:

Enviar um comentário