I am assuming that you want to retrieve all the records where date of birth is on Jan 2012 or Feb 2012. If that's the case you can use
DATEPART[
^] to filter your rows.
try
SELECT COUNT(*) AS TotalRows FROM DOB
WHERE (DATEPART(Month,dateOfBirth) = 1 OR DATEPART(Month,dateOfBirth) = 2) AND (DATEPART(year,dateOfBirth) = 2012)
Edit:
SqlFunctions Class[
^] might help you. Take a look at
SqlFunctions.DatePart Method[
^].
Also check out this CP article
LINQ query to compare only date part of DateTime[
^]