select cast(cast('1 Jan 2010' as datetime) as int); --returns 40177 select cast(cast('27 Apr 2011' as datetime) as int) - cast(cast('1 Jan 2010' as datetime) as int); --returns 481 update transactions set requesteddatetimeutc = cast((RAND(convert(varbinary,newid()))*481 + 40177) as datetime);
Wednesday, April 27, 2011
Generating random date data in SQL Server 2005
The statement below will generate random dates between 1 January 2010 and 27 Apr 2011.
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment