Commit df60c87
committed
Document date/time addition change at compatibility level 110
At compatibility level 100 and below, the addition operator accepts an operand
of type `DATE`, `TIME`, `DATETIME2`, or `DATETIMEOFFSET` if the other operand
has type `DATETIME` or `SMALLDATETIME`. At compatibility level 110 and
higher, an operand of type `DATE`, `TIME`, `DATETIME2`, or `DATETIMEOFFSET`
causes an error. For example:
```sql
SELECT CAST('2021-12-31T00:00:00' AS DATETIME) + CAST('17:00:00' AS TIME);
```
At compatibilty level 100:
> 2021-12-31 17:00:00.000
At compatibility level 110:
> Msg 402, Level 16, State 1, Line 1
> The data types datetime and time are incompatible in the add operator.
Add this to the "Differences between Lower Compatibility Levels and Levels 100
and 110" in the [ALTER DATABASE Compatibility Level (Transact-SQL)] page.
[ALTER DATABASE Compatibility Level (Transact-SQL)]: https://docs.microsoft.com/en-us/sql/t-sql/statements/alter-database-transact-sql-compatibility-level
Signed-off-by: Kevin Locke <kevin@kevinlocke.name>1 parent 4cbd261 commit df60c87
1 file changed
Lines changed: 1 addition & 0 deletions
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
281 | 281 | | |
282 | 282 | | |
283 | 283 | | |
| 284 | + | |
284 | 285 | | |
285 | 286 | | |
286 | 287 | | |
| |||
0 commit comments