Question - How do I retrieve rows based on datetime values?
Answer -
SQL Server recognizes date and time data enclosed in single quotes. You can couple date and time values together or use them independently. You can also combine character date formats ('May 15, 2004 4 am'), numeric date formats ('5/15/2004 04:30'), or contiguous string formats ('20040515') with standard <, >, or = operators, as the following example shows:
SELECT * FROM orders WHERE OrderDate < 'May 15, 2004'4. How do I retrieve only the date or time portion of the data?