SQL tips

1. SQL compare date·  WHERE DateDiff(dd, OrderDate, ’01/01/2006′) = 0

·  WHERE Convert(varchar(20), OrderDate, 101) = ’01/01/2006′

·  WHERE Year(OrderDate) = 2006 AND Month(OrderDate) = 1 and Day(OrderDate)=1

·  WHERE OrderDate LIKE ’01/01/2006%’

·  WHERE OrderDate >= ’01/01/2006′  AND OrderDate < ’01/02/2006′
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=38012

http://www.dba-oracle.com/t_sql_compare_two_date_ranges.htm

2.  Express builder to create date compare

http://www.java-examples.com/compare-two-java-date-objects-using-compareto-method-example

Advertisements