I want to convert a data of type varchar to int, then I want to convert the result to minutes to get an average from there. This is the field:
What I am doing first is separating the fields in this way:
select sum (convert(float, substring(RalentiTiempoTotal,1,2))/60 + convert(int, substring(RalentiTiempoTotal,4,2))/3600) from Tabladatos
In the first select what I do, I'm converting hours to minutes and then minutes to seconds. But it does not give me the result I want.
I know that in MySQL, there is a function (TIME_TO_SEC), which is used to calculate the minutes directly. What would be the equivalent to SQL Server?.
Can someone help me please? Thanks.