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

HOW TO APPLY CASE WHEN IN DATEDIFF?

$
0
0

Dear All,

May i know how to  write in case when to show the result ?

example, if datediff result is  more than 13 hour, then the actual result i want is fix in 12 hour only.

KINDLY ADVISE, THANK YOU

Case when FIRSTSCAN.EP_SCAN_DATE > 13 hour

then show 12 hour only

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>