2015-04-11

TSQL - Get the greater of two given dates

ALTER function [dbo].[getGreatestDate](
       @date1 date
       , @date2 date
)
returns date
as
begin
       return(
              case when isnull(@date1,'1/1/1900') >= isnull(@date2,'1/1/1900') then @date1 else @date2 end
       );
end
;

 g

No comments:

Post a Comment