Hi Anusha, You have to do casting one more time for minute on the following line: Cast((datediff(n,startime,endtime)- (SELECT ISNULL(SUM(DATEDIFF( n , TStoptime , Restarttime )),0) You need to cast it again to convert this resultset in the Minute format. Let me know in case you are not able to do that.
Regards, Amit Kumar HDISM, PGDCA, MCP, MCAD, MCSD amit_chikara2002@hotmail.com