mardi 22 août 2017

Generating random string with T-SQL

DECLARE @tmp char(1) = '';
SET @tmp = CAST(RAND()*26 AS int)+97;

This code doesn't work. The same expression with select works well:

SELECT CAST(RAND()*26 AS int)+97;

May be my @tmp is declared with a wrong data type?




Aucun commentaire:

Enregistrer un commentaire