|
Archives of the TeradataForumMessage Posted: Fri, 04 Mar 2005 @ 10:54:31 GMT
Hi, For your query u can give like that: Select STORE_COUNT, Random(1,5) from Table_Name; The RANDOM function may be used to generate a random number between a specified range. RANDOM (Lower limit, Upper limit) returns a random number between the lower and upper limits inclusive. Both limits must be specified, otherwise a random number between 0 and approximately 4 billion is generated. Consider the department table, which consists of nine rows. SELECT department_number FROM department; department_number ----------------- 501 301 201 600 100 402 403 302 401 Example: Assign a random number between 1 and 9 to each department. SELECT department_number, RANDOM(1,9) FROM department; department_number Random(1,9) ----------------- ----------- 501 2 301 6 201 3 600 7 100 3 402 2 403 1 302 5 401 1 Note it is possible for random numbers to repeat. The RANDOM function is activated for each row processed, thus duplicate random values are possible. Regards, Abdul Wahab.
| ||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||
Copyright 2016 - All Rights Reserved | ||||||||||||||||||||||||||||||||||||||||||||||||
Last Modified: 15 Jun 2023 | ||||||||||||||||||||||||||||||||||||||||||||||||