vendredi 5 octobre 2018

Set “seed” for random number generation with Temporary tables in Redshift Sql?

How to use a “seed” for random number generation with Temporary tables in Redshift Sql?

-- Without temp table seed works: result is always 21

set seed to .25;
select cast (random() * 100 as int);


-- With temp table seed does not work: 

set seed to .25;
drop table  if exists a;
CREATE TEMP TABLE a 
as(select cast (random() * 100 as int));
select * from a;

Many thanks in advance




Aucun commentaire:

Enregistrer un commentaire