tags:

views:

27

answers:

1

Hi all i want to take record from table named Tblbatch where batch starting date should be from augest 2007 to july 2010... I want to fetch such records which came in between this two dates

+3  A: 
Select * from Tblbatch where startDate between '01-08-2007' and '31-07-2010'
  • provided you have a datetime column "startDate"

Note : that using between includes both the dates specified. If you want to avoid the dates either change the boundary dates to + - 1 respectively or use > and < conditions

InSane
Please note that '01-08-2007' is ambiguous to SQL Server (it may be 8th Jan or 1st Aug). the safe format for dates (with no time component) is 'YYYYMMDD', e.g '20070801'
Damien_The_Unbeliever