The below query returns SELECT REPLACE( RIGHT( REPLICATE('0',5 - LEN(5)) + CONVERT(VARCHAR(18), RB.Batch), 5) + '.00', '.', ':') FROM RunningBatch AS RB 80:00:00 70:00:00 08:02:00 10:00:00 06:00:00 How can I able to cast this to sys.Time Thanks
Sorry now it is within 24 hours SELECT CAST( CONVERT(VARCHAR(18), REPLACE( RIGHT( REPLICATE('0',5 - LEN(5)) + CONVERT(VARCHAR(18), VRB.VHRBatchHrsKm), 5) + '00', '.', '')) AS sys.time) FROM Vehicle.VehicleRunningBatch AS VRB I got Conversion failed when converting date and/or time from character string.
I'm still confused... Can you please explain what that values should be interpreted as and what the output should look like?