Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

HOW TO REMOVE NEGATIVE VALUES IN HOUR & MIN ?

$
0
0

Dear All,

How i remove the negative result in hour ?

is it can use case when ?

                ,CASE DATEDIFF(HOUR,(CONVERT(VARCHAR(14),stuff(stuff(FIRSTSCAN.EP_SCAN_DATE,9,0,SHIFTDESC.EP_SHIFT_TIMEFR),9,0,' '),112))
                 ,CONVERT(varchar(14),stuff(LASTSCAN.EP_SCAN_DATE,12,0,':'),112)) WHEN 13 THEN 12 
                 ELSE DATEDIFF(HOUR,(CONVERT(VARCHAR(14),stuff(stuff(FIRSTSCAN.EP_SCAN_DATE,9,0,SHIFTDESC.EP_SHIFT_TIMEFR),9,0,' '),112))
                 ,CONVERT(varchar(14),stuff(LASTSCAN.EP_SCAN_DATE,12,0,':'),112)) END AS datetimetest 


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>