Skip to content
Advertisement

Is it possible to sum up time field in SQL Server?

Example

I have 3 time(0) column in 1 row. I want to calculate arrival-Time column automatically and this is result of the sum of Departure-Time + Duration

is it possible with trigger or computed area method? thanks in advance

Advertisement

Answer

SQL Server does not support direct addition on time values; however, you can use datediff against 0 to find how many (of some interval – minutes, seconds, etc; choice depends on your required precision) to calculate the duration, and then dateadd the same:

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement