Hi all,
The below is suppose to generate random dates but I receive the following error:
Msg 8115, Level 16, State 2, Line 7
Arithmetic overflow error converting expression to data type datetime.
SQL Below - if is this happening?
DECLARE
@MinDate INT, @MaxDate INT;
DECLARE
@RANGE INT = DATEDIFF(DD, @MinDate, @MaxDate);
SET @MaxDate =20141212
SET @MinDate = 20140101
SELECT CONVERT(DATE, DATEADD(DD, ROUND(RAND(CAST(NEWID() AS VARBINARY)) * @RANGE,0,-1), @MinDate));