Alex Gordon
Alex Gordon

Reputation: 60691

Counting values between two dates

I am trying to count all the rows in the month of December:

select COUNT(*) from quicklabdumpgood
where [Date Entered]>'20111131'
and [Date Entered]<'20120101'

but my problem is that:

Msg 241, Level 16, State 1, Line 1
Conversion failed when converting date and/or time from character string.

It looks like some of the [date entered] fields are empty. How do I NOT count them if they are empty?

Please note that [date entered] is DATE not DATETIME

Upvotes: 1

Views: 182

Answers (1)

Nick Vaccaro
Nick Vaccaro

Reputation: 5504

There is no November 31st. : )

Upvotes: 15

Related Questions