Technical Article

Match Date Only

,

Here is a simple function to compare datepart of datetime fields , (no need to say ignores hour t,min,sec ... ) isDateMatch(@date1,@date2 ) retruns 1 if the datepart matches else returns 0

regards
john

create function isDateMatch(@date1 datetime ,@date2 datetime )
returns int
as
begin

declare @ret_val int
set @ret_val=0


if year(@date1)=year(@date2) and month(@date1)=month(@date2) and day(@date1)=day(@date2)
begin
set @ret_val=1
end

return @ret_val

end

Rate

2 (1)

You rated this post out of 5. Change rating

Share

Share

Rate

2 (1)

You rated this post out of 5. Change rating