This code should do what you want. I also added one more column to demo how to generate a random datetime within each 20 minute range.declare @t table (Number int not null primary key clustered,Rand_Int int not null,Random_Time datetime not null)insert into @tselect Number, -- Function F_RANDOM_INTEGER available in Script Library forum -- http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=69499 -- Get integer in range of 1 to 1,500,000,000 to 2,000,000,000 Random_Int = [dbo].[F_RANDOM_INTEGER](1500000000,2000000000,newid()), -- Function F_RANDOM_DATETIME available in Script Library forum -- http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=69499 -- Get random time in 20 minute range Random_Time = [dbo].[F_RANDOM_DATETIME]('00:00:00.000','00:20:00.000',newid())from -- Function F_TABLE_NUMBER_RANGE available in Script Library forum -- http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=47685 F_TABLE_NUMBER_RANGE(0,599)select --Number, Rand_Num = convert(numeric(15,9),Rand_Int*0.000000001), Time_Period = dateadd(minute,NUMBER*20,'20070429'), -- Random time in 20 minute range Rand_Time = dateadd(minute,NUMBER*20,'20070429')+Random_Timefrom @t aorder by NUMBERResults:(600 row(s) affected)Rand_Num Time_Period Rand_Time----------------- ------------------------------------------------------ ------------------------1.840428869 2007-04-29 00:00:00.000 2007-04-29 00:09:33.0131.670566966 2007-04-29 00:20:00.000 2007-04-29 00:34:32.9771.895743348 2007-04-29 00:40:00.000 2007-04-29 00:49:37.4771.881807968 2007-04-29 01:00:00.000 2007-04-29 01:00:19.4971.528415225 2007-04-29 01:20:00.000 2007-04-29 01:24:04.1431.614305759 2007-04-29 01:40:00.000 2007-04-29 01:48:35.000......1.573224994 2007-05-07 06:20:00.000 2007-05-07 06:21:14.8671.688978319 2007-05-07 06:40:00.000 2007-05-07 06:52:06.6131.967219298 2007-05-07 07:00:00.000 2007-05-07 07:11:00.1671.867450782 2007-05-07 07:20:00.000 2007-05-07 07:24:38.9101.614694445 2007-05-07 07:40:00.000 2007-05-07 07:46:18.590(600 row(s) affected)
CODO ERGO SUMEdit: Added code I missed with cut/paste