Steve Fama
Steve Fama

Reputation: 5

Searching for records using Date >=

I have a small table and want to search for records that are >= to June 1, 2021. I did the following

Select ApplyDate from zPermitsToCAMA where ApplyDate >=2019-01-01

I'm getting Msg 206, Level 16, State 2, Line 1 Operand type clash: date is incompatible with int

Upvotes: 0

Views: 396

Answers (1)

pwilcox
pwilcox

Reputation: 5753

Select ApplyDate from zPermitsToCAMA where ApplyDate >= 2019-01-01

evaluates to

Select ApplyDate from zPermitsToCAMA where ApplyDate >= 2017

(start with 2019 and subtract 1 twice)

You want to quote the date

Select ApplyDate from zPermitsToCAMA where ApplyDate >= '2019-01-01'

Upvotes: 1

Related Questions