Skip to main content
Ben Nadel
On User Experience (UX) Design, JavaScript, ColdFusion, Node.js, Life, and Love.


Member since Jul 7, 2009

Recent Blog Comments By CRH

  • Ask Ben: Getting A Random Date From A Date Range In SQL

    Posted on Jul 7, 2009 at 1:48 PM

    Here's a slightly modified version... selecting a random time during an 8hr period during a particular day. (28800 is the number of seconds in 8 hours.) I send the NEWID() through RAND() to guarantee a unique timestamp for each row. DECLARE @date_from DATETIME; DECLARE @date_to DATETIME; SET @... read more »