Baz Baz - 5 months ago 8
SQL Question

List rows after specific date

I have a column in my database called "dob" of type datetime. How do I select all the rows after a specific dob for Sql Server 2005?

Thank!

Answer

Simply put:

SELECT * 
FROM TABLE_NAME
WHERE
dob > '1/12/2012'

Where 1/12/2012 is the date and you want all data, including that date.

SELECT * 
FROM TABLE_NAME
WHERE
dob BETWEEN '1/12/2012' AND '2/10/2012'

Use a between if you're selecting time between two dates