Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Example_Table

Row

InvoiceDate

1

2023-01-01 00:00:00.000

2

2024-03-01 00:00:00.000

3

2024-03-02 00:00:00.000

Select from SELECT … FROM Example_Table WHERE …

Rows #s returned

Code Block
languagesql
SelectSELECT InvoiceDate  FROM Example_Table  WHERE InvoiceDate >= 2024-01-03

Select InvoiceDate FROM Example_Table WHERE InvoiceDate >= 2024-01-03

...

 10:24:48.168

Why not row # 2? 2024-03-01 00:00:00.000 is less than 2024-03-01

...

10:24:48.168

1

Code Block
languagesql
SELECT InvoiceDate FROM Example_Table WHERE InvoiceDate >= 2024-01-03

Why? 2024-03-01

...

should be converted internally to 2024-03-01 00:00:00.000

...

1 and 2

Target Value or Constant

Example: When run on 2024-03-03 at 10:24:48.168 

T-SQL Expression

DATEADD(DAY,-2,GETDATE())

DATEADD(DAY,-2,CONVERT(DATE, GETDATE())

returns value

2024-03-01 10:24:48.168

 2024-01-03

data type

datetime

date

...