Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2007

    Unanswered: help!!!!to generate random data....

    Dear All,
    I have some problems with the assignment from my professor.

    Suppose there are two tables storing first names and last names, one table with column of first name and gender, the other with last name.

    how to write stored procedures to get a random first name + random last name for Males or Female. like you got a list of all M & F first name and last name, then you try to match first name with any other last name (I believe this is random).

    and the task is to write a script so each time when a female or male full name is need, it will return a random name for the requested gender.

    I am totally struck and no idea how to deal with it, in fact I am just a beginning in SQL server, and I know there is a stored procedure to generate random number, however, I can't see the use of it here,,,,

    Could anyone help me out ? thanks very much !!!

  2. #2
    Join Date
    May 2004
    you can use RAND() to generate pseudo-random numbers in sql server.

    based on the value of the return, you can use that to determine the names you select, and another call to rand() to select the gender.

    presumably you have a list of female and male names to choose from?

  3. #3
    Join Date
    Apr 2007

Posting Permissions

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