Timeline for Datetime2 rounding issue
Current License: CC BY-SA 4.0
4 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 14, 2023 at 18:44 | comment | added | Bill Menees | I'm showing how to do the truncation, which is "the hard part". To avoid SQL's default rounding behavior, you have to load the data into a temporary datetime2(7) (either a variable or a temp table) and then do the calculation to get the less precise datetime2. The subsequent operation (insert or select) is an easy step from there. | |
Apr 14, 2023 at 16:57 | comment | added | mustaccio | The question is how to truncate upon insert, not when selecting existing data though, isn't it? | |
S Apr 14, 2023 at 16:40 | review | First answers | |||
Apr 14, 2023 at 20:21 | |||||
S Apr 14, 2023 at 16:40 | history | answered | Bill Menees | CC BY-SA 4.0 |