Question

For testing an algorithm I would like to generate 10,000 random birthdates from 01/01/1995 to 31/12/2013. Can this be done in SQL and how?

Thank you in advance

Was it helpful?

Solution

To generate a random date:

select cast(cast(RAND()*100000 as int) as datetime)

You can then write code around this statement to limit it to a range.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top