/*
--
Execution
select
dbo.getLowerDate( '1/31/2012', '8/30/2012' );
select
dbo.getLowerDate( '1/31/2012', null );
select
dbo.getLowerDate( null, '8/30/2012' );
select
dbo.getLowerDate( null, null );
*/
ALTER function [dbo].[getLowerDate](
@date1 date
, @date2 date
)
returns date
as
begin
return(
case when isnull(@date1,'12/31/2099') <= isnull(@date2,'12/31/2099') then @date1 else @date2 end
);
end
;
No comments:
Post a Comment