• Lots of different solutions.

    The only one that won't always work is the answer given.

    As a reader based in continental europe, I should point out the fact that if you're running SQL server in any language other than English, then you'll almost certainly get a different result for datepart(m,dob) like '%e%'

    Try changing the language to Italian, and see how your code runs 😉

    SET LANGUAGE Italian