473,382 Members | 1,736 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

sql year function

Prasant jinaga
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
Nov 14 '11 #1
2 2097
Rabbit
12,516 Expert Mod 8TB
Sounds like you have records with a reqdate after the current date.
Nov 14 '11 #2
why don't you try like this
Year(CONVERT(VARCHAR,REQDATE,101)) = 2011
Dec 1 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Fendi Baba | last post by:
The function is called from opencalendar(targetfield). Thanks for any hints on what could be the problem. .............................................................. var...
2
by: Paolo | last post by:
I have a form with three fields: STARTINGDATE ENDINGDATE YEARS I would like the YEARS field to show the number of years which elaps from the STARTINGDATE TO THE ENDINGDATE fields. Please...
1
by: Gobi | last post by:
Hello everyone, I have a database of clients that has a Date_Closed Field and a Table_Name field along w/other various client infor. At the end of the year, files get moved into a "History" table...
3
by: ethoemmes | last post by:
Hi Does anyone know of a function I can use to return the current tax year. Our tax year runs from 6 April. I need a function which will return the tax year for a given date. TIA
3
by: MIG | last post by:
I had a form which used year(date) to compare an input value with the year of today's date. This was working fine. Now, for some reason, I am getting run-time error 2465 "Library Catalogue...
3
by: Agnes | last post by:
In my old vfp application, there is DTOS function to return 'yyyymm' ,in .net any similar function ?? DTOS(datetime.now) and return yyyymm, I know that I can CType(Year(datetime.now), String) &...
4
by: Vasilis X | last post by:
Hello. I want to use the excel function Year( ) (or Day, Month, Minute etc...) in a Visual Basic .net application. How can i do this? I tried Excel.WorksheetFunction but this class doesn't...
1
by: rkohon | last post by:
Hello all, I am new to JavaScript and need some ideas, suggestions, or code snippets. I have a form which requires the end user to put in a date for required items. I need javascript function to...
9
by: beechclose | last post by:
I need to extract the year part of a date and I have the following code to test Private Sub Form_Open(Cancel As Integer) Dim mydate, myyear mydate = Date myyear = Year(mydate) End Sub
5
by: munkee | last post by:
Hi all, I am using a form to basically display monthly and fiscal year to date figures. I use the following code in the submit button (combo boxes populare year, month, department and incident...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.