次のコードで日付をランダム化できました
DATEADD (day, CAST (RAND () * 365 as int), '2010-1-1')
1 から 7 まで、および 1 から 126 までの数値に対して実行する必要があります。
手伝ってくれますか?
SELECT 'Booking_' + Cast(Seed.Seed as varchar(25)) as BookingNo,
DATEADD(day, ABS(CHECKSUM(NEWID()) % 800), '1 Jan 2010') as ArrivalDate,
DATEADD (day, CAST (RAND () * 365 as int), '2010-1-1') % 6 + 1 as PitchType
FROM Seed CROSS JOIN
Seed AS Seed_1 CROSS JOIN
Seed AS Seed_2 CROSS JOIN
Seed AS Seed_3 CROSS JOIN
Seed AS Seed_4 CROSS JOIN
Seed AS Seed_5