As per the documentation, the return type of DATEADD is the same as the input: You need to consider how you want to handle calculations that lead to either or both and to be in the next day.Īlso - to address another new requirement in your "ideal answer" - there is no loss of precision. I assume this must go through some type of internal conversion, because you couldn't get that result by saying: DECLARE TIME(0) = '24:19' Ĭonversion failed when converting date and/or time from character string. This doesn't yield an error, however, just might not be the result you're expecting. Try: DATEADD(MINUTE, that even though you have protected your from overflow, you haven't protected the result from overflow. You can't use lazy shorthand arithmetic with the new types.
![sql server minus minutes to getdate sql server minus minutes to getdate](http://blog.sqlauthority.com/i/b/format3.jpg)
![sql server minus minutes to getdate sql server minus minutes to getdate](https://www.jquery-az.com/wp-content/uploads/2018/04/19-3-SQL-GETDATE-INSERT.png)
If there are no issues then please state so. Issues or concerns to be aware of in the event that the minutes would be to too large to fit in a time variable, or risk of rolling the time variable over.That the proposed solution does not result in a loss of precision.
#Sql server minus minutes to getdate how to#
![sql server minus minutes to getdate sql server minus minutes to getdate](https://codeontime.com/blog/2011/05/sql-anywhere-web-applications-in/image23.png)
(/*Other columns*/ columns*/ + + ELSE does.*/ INSERT INTO ClientNotification (/*Other columns*/ startTime, endTime) SET = % 1440 -Prevent overflow if needed? I have a stored procedure which inserts two records into a table, the difference between the records is that the time column of the second record is after the first: CREATE PROCEDURE CreateEntry