A variable declared of DateTime type accepts Integer and NUmeric values , where as rest data types in the same group (DATE,TIME,DATETIME2) doesn't accept.
If an integer value is assigned , SQL server returns a datetime value with those No. of days added to 1900-01-01 value.
When a numeric value is assigned , the integer part is considered as no.of days and the decimal value into time(o.1 means 2.24 hours).
declare @date date,@datetime datetime,@time time,@datetime2 datetime2 --set @date=1990 set @datetime=1990.1 --set @time=1990 --set @datetime2=1990 select @date,@datetime,@time, @datetime2
Does any one noticed this kind of behavior with datetime?
Thanks
Sarat
Please use Marked as Answer if my post solved your problem and useVote As Helpful if a post was useful.