| Author |
Message |
batdan@libero.it
Joined: 12 Apr 2010 Posts: 2
|
Posted: Mon Apr 12, 2010 3:19 pm Post subject: Random Date Generation |
|
|
Hi all,
there is a method to generate random date time from a valid range?
If exists only the Regex method wich is the right regex expression to generate valid date?
Thank's |
|
| Back to top |
|
 |
peter.peartSite Admin
Joined: 02 Sep 2008 Posts: 362 Location: Top floor, RG towers with the cool kids
|
Posted: Wed Apr 14, 2010 4:24 pm Post subject: |
|
|
Hi there,
Many thanks for your post, although I am not entirely sure what you are looking for I am afraid.
SQL Data Generator will generate a date / time which is random on any column that uses the datetime datatype. From here, you can then choose the minimum and maximum date and select to randomize the time, without the need to use a regex.
Pete[/img] _________________ Peter Peart
Red Gate Software Ltd
+44 (0)870 160 0037 ext. 8569
1 866 RED GATE ext. 8569 |
|
| Back to top |
|
 |
batdan@libero.it
Joined: 12 Apr 2010 Posts: 2
|
Posted: Wed Apr 14, 2010 4:38 pm Post subject: |
|
|
Sorry for my english.
The problem is that i don't have a datetime datatype. I have a varchar column.
It's possible to generate random DateTime between a range in varchar column? If Yes how to do this?
How to generate DateTime in a DateTime column?
Many thank's |
|
| Back to top |
|
 |
peter.peartSite Admin
Joined: 02 Sep 2008 Posts: 362 Location: Top floor, RG towers with the cool kids
|
Posted: Wed Apr 14, 2010 4:49 pm Post subject: |
|
|
Hi there,
If you have a varchar column then you will indeed have to use a regex. Something like this will work, although provides dates a fair way back into the past and into the future:
(0[1-9]|[12][0-9]|3[01])[/](0[1-9]|1[012])[/](19|20)[0-9]{2}
It should be enough to get you going hopefully though!
HTH!
Pete _________________ Peter Peart
Red Gate Software Ltd
+44 (0)870 160 0037 ext. 8569
1 866 RED GATE ext. 8569 |
|
| Back to top |
|
 |
|
|
All times are GMT + 1 Hour
|
| Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group