I have been using SQL Server for quite sometime and noticed a change in behavior while using datetimeoffset.
Lets take an example of two queries, one is using normal string comparison in datetime values and one which is using datetimeoffset type viz
select * from (
select cast('2019-09-06 11:28:05.757' as datetime) as test_date
) data where test_date < '2019-09-06 11:28:05.757'
DECLARE @P1 datetimeoffset;
set @P1 = '2019-09-06 11:28:05.757';
select * from (
select cast('2019-09-06 11:28:05.757' as datetime) as test_date
) data where test_date < @P1
I executed the above queries in SQL Server 2014 and SQL Server 2019 and the difference comes in the execution of second query, where for SQL Server 2019 it gives the results as the corresponding date
I wanted to check if there is some change in behavior with respect to the datetimeoffset parameter type in the latest versions of SQL Server.
