You can use either one of the following way using(
>= and <= OR
Between )
declare @StartDate DATETIME,
@EndDate DATETIME
select @StartDate = '2011/01/02',
@EndDate = '2011/01/03'
select * from TB_Table1 where CONVERT(VARCHAR,col2,111) >= @StartDate
and CONVERT(VARCHAR,col2,111) <=@EndDate
OR
declare @StartDate DATETIME,
@EndDate DATETIME
select @StartDate = '2011/01/02 00:00:00',
@EndDate = '2011/01/03 23:59:59'
select * from TB_Table1 where col2 >= @StartDate
and col2 <=@EndDate
OR
declare @StartDate DATETIME,
@EndDate DATETIME
select @StartDate = '2011/01/02 00:00:00',
@EndDate = '2011/01/03 23:59:59'
select * from TB_Table1 where col2 between @StartDate and @EndDate
Cheers
www.sqlserverbuddy.blogspot.com
Cheers
www.SQLServerbuddy.blogspot.com
iLink Multitech Solutions
Sravanthi.seeta, if this helps please login to Mark As Answer. | Alert Moderator