Home > Forum > Sql Server > I need to fetch for current year but it shows previous year data also in sql server 2005

I need to fetch for current year but it shows previous year data also in sql server 2005

by celv   on Jan 04, 2015   Category: Sql Server  |  Views: 1017    |  Points: 5   |  Bronze 
  Reply
select * from Expenzsection where SectionName='bm' and date between '01/01/2015' and '04/01/2015' order by date


output

BM 01/01/2015
BM 01/01/2015
BM 01/01/2015
BM 01/01/2015
BM 01/01/2015
BM 01/01/2015
BM 01/01/2015
BM 01/01/2015
BM 01/01/2015
BM 01/01/2015
BM 01/01/2015
BM 01/01/2015
BM 01/01/2015
BM 01/12/2014
BM 01/12/2014

Bookmark and Share:
 
  User Reply  | Ask a question  |   Reply 
  Re :I need to fetch for current year but it shows previous year data also in sql server 2005   
by Thamil
on Feb 3 2015 6:26AM
Points : 10
Gold 
Hi Celv, Please verify the Date column datatype, it should be date datatype
  Re :I need to fetch for current year but it shows previous year data also in sql server 2005   
by Santosh Kumar Bind
on Jul 22 2015 11:40PM
Points : 10
Starter 
Please Use the Cast fonction in Date then u try to resolve

Recent Post

Latest Posts