Browse 540 attributed reviews, viewable separately for our classroom and online training

Details for kalaivanan

kalaivanan has participated in the following threads:

Added by kalaivanan on 04 Jul 2017 at 07:20

One possible answer:

CREATE FUNCTION fnRegion(@FirstDate DATE,@LastDate DATE)
RETURNS INT
AS
BEGIN
DECLARE @Date_Diff INT
SELECT @Date_Diff=DateDIff(day,@FirstDate,ISNULL(@LastDate,Getdate()))
RETURN  @Date_Diff
END

***************************************************************************************************************************
select DoctorName,dbo.fnRegion(FirstEpisodeDate,LastEpisodeDate)[Reign in days] from tblDoctor
****************************************************************************************************************************