Reputation: 48
select CONVERT(date,d) as dateX
from dates
where d >= '2008-01-01' and d< '2079-12-31'
CAST(d as DATE)
caused the same error.
Where d is smalldatetime type in a one column dates dimension.
The conversion of a varchar data type to a smalldatetime data type resulted in an out-of-range value.
Upvotes: 0
Views: 453
Reputation: 1269443
Smalldatetime
is documented to have a range between 1900-01-01 and '2079-06-06'.
Hence, your value is out of range.
Use datetime
or datetime2
or a maximum value in range -- say '2078-12-31'.
Upvotes: 7