Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
wafw1971
Yak Posting Veteran
75 Posts |
Posted - 2013-02-20 : 09:13:01
|
0down votefavorite I have just been told I have done it completely wrong by my boss and the query above hasn't randomised anything on our data, I have got 48000 records with a 2 night stay, 48000 records for a 27 night stay etc.What I need is 30% of the departure dates to be 2 days in length, 10% of the departure dates to be 3 Days in length and the rest to be randomised amongst 1, 4 to 28. I know it involves case statement but I don't know how to do them.Can anyone help?Update bookingsSet DepartureDate = DATEADD(day, 1 + RAND(CHECKSUM(NEWID()))*28, ArrivalDate)SELECT * FROM bookingsThanks Wayne |
|
|
|
|