Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2013
    Posts
    4

    Unanswered: Help to create random numbers. How to create in DB2 9.7?

    How to create a random numbers in the range 10-199?, try the following command:
    SET SCOD= RAND ()*199 + 10;

    Numbers are generated but always out of range.

    Thanks for helping!
    Last edited by Rodrigo VR; 11-05-13 at 23:08.

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    I'm surprised it generates anything at all on your system -- I would assume it'd give a syntax error.

    What is the intent of "(10-200-1)"?
    ---
    "It does not work" is not a valid problem statement.

  3. #3
    Join Date
    Oct 2013
    Posts
    4
    Quote Originally Posted by n_i View Post
    I'm surprised it generates anything at all on your system -- I would assume it'd give a syntax error.

    What is the intent of "(10-200-1)"?
    thank you, I do not know what to say ... I think pasted one debug line by mistake

  4. #4
    Join Date
    Mar 2003
    Posts
    280
    Quote Originally Posted by Rodrigo VR View Post
    How to create a random numbers in the range 10-199?, try the following command:
    SET SCOD= RAND ()*199 + 10;

    Numbers are generated but always out of range.

    Thanks for helping!
    int(189*rand())+10
    --
    Lennart

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •