Can i Generate random numbers in Teradata?
There is a scenario in which I need to generate RANDOM numbers for a given column (integer ). In teradata we can use a function called as RANDOM(min_value, max_value) .
This is implemented in sql as follows.
Select RANDOM(1,500) from table;
Please note: There might be cases where Random function can produce duplicate values. SO while designing tables , make sure that the column making use of RANDOM is not part of UNIQUE PRIMARY INDEX
This is implemented in sql as follows.
Select RANDOM(1,500) from table;
Please note: There might be cases where Random function can produce duplicate values. SO while designing tables , make sure that the column making use of RANDOM is not part of UNIQUE PRIMARY INDEX
No comments:
Post a Comment
Thank you :
- kareem