Monday, September 20, 2010

date diff

--date difference its give diff to hh/mm/ssCREATE
 
 
 
 
 
 SELECT @DATEDIFF = DATEDIFF(SS,@DATE,GETDATE())

 IF((@DATEDIFF % @TEST) <>0)

 
 
 END

 
 BEGIN

 
 END

 
 END


SELECT
DBO.DAYDIFF('2010-09-19 12:11:50.750')NO_OF_DAYS
RETURN @NO_OF_DAYS
SET @NO_OF_DAYS = @DATEDIFF/@TEST
ELSE
SET @NO_OF_DAYS = (@DATEDIFF/@TEST)+1
BEGIN
SET @TEST = 86400
/* @test represents no of seconds per day */
DECLARE @NO_OF_DAYS INT
DECLARE @TEST INT
DECLARE @DATEDIFF INT
AS

BEGIN
FUNCTION DAYDIFF(@DATE SMALLDATETIME)RETURNS INT

No comments:

Post a Comment