Reputation: 77
I have this table
And I just need sum column Duracao + Hora to obtain a new column named Return, like this:
In correct scenario, result of column Return must be 18:06:07. How can I get it?
Upvotes: 0
Views: 309
Reputation: 272006
Assuming that Hora contains the varchar value 18:06:02 and Duracao contains the varchar value 00:00:05, you can convert them to DATETIME
, then add them like so:
SELECT CONVERT(
VARCHAR(8),
DATEADD(
SECOND,
DATEDIFF(SECOND, 0, CAST(Duracao AS DATETIME)),
CAST(Hora AS DATETIME)
),
108
)
Upvotes: 1