How to convert “3 Days 18 Hours 39 Minutes” into seconds in SQL Server?
Advertisement
Answer
DECLARE @formula varchar(1000) set @formula = 'select ' + replace(replace(replace('2h 2m', ' ', '+'),'h','*60*60'),'m','*60') execute(@formula)
Here is a more generic formula you can use. It is fairly error prone though