sql year function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Prasant jinaga
    New Member
    • Dec 2010
    • 7

    sql year function

    Hi,

    I have a query to fetch out some records based on the year,In the where clause when i am fetching on the basis of Date range i.e,1st Jan'2011 and Today's Date like

    CONVERT(VARCHAR ,REQDATE,101) BETWEEN CONVERT(VARCHAR ,'01/01/2011',101) AND CONVERT(VARCHAR ,'11/12/2011',101)

    Its giving exact amount of rows but when i'm using year function like

    Year(a.REQDATE )= 2011

    Its not giving the exact count...what could be the scenario???

    Can any one help on this Please???

    Thanks,
    Prasant
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Sounds like you have records with a reqdate after the current date.

    Comment

    • dave8689
      New Member
      • Dec 2011
      • 2

      #3
      why don't you try like this
      Year(CONVERT(VA RCHAR,REQDATE,1 01)) = 2011

      Comment

      Working...