Concatenate Time and minutes in SQL server

0

I have the following query:

CONVERT(TIME,convert(varchar,F.T2InHour)+convert(varchar,F.T2InMinute),108)

What I want is the following in F.T2InHour I have the Hour and In F.T2InMinute I have the minutes, I want to join them and I get the time and minutes Example ASi 8:30:00

    
asked by Frankenstainero 17.01.2018 в 20:57
source

1 answer

0

What you can do is the following:

SELECT CONVERT(TIME, 
                 LEFT(CONVERT(VARCHAR, 100 + F.T2InHour),2) + ':' +
                 LEFT(CONVERT(VARCHAR, 100 + F.T2InMinute),2) + ':00'
              )
       FROM ....

We simply format a string as hh:mm:00 and then convert it to a% TIME .

    
answered by 18.01.2018 / 14:01
source