473,508 Members | 2,079 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

search value from table by date

23 New Member
hi,All thanks in advance. i need a help.
i am working with a sql server 2005 database. where a table contains data like INTNO, name, dateofpurchase , item
now i want to search the value based on name and dateofpurchase fields. but not value is retrieving. i don't know what is happening.

here is the code i am using.

<code>
select INTNO from Point_item_master where PointName='ABC' and Date='1/12/2010'
</code>

PLEASE HELP

NEEL
Jan 14 '11 #1
12 1859
guillermobytes
77 New Member
hi,
how do you store your dates in mysql : as a string or as a date?
what does it return if you make the same query without date in the where clause?
Jan 14 '11 #2
neelmukhopadhya
23 New Member
i am using MS sql server 2005. and i am storing as a date.
and if i make query without date it is running fine.
but when i am using date it is not returning any value.

Regards
Neel
Jan 14 '11 #3
Rabbit
12,516 Recognized Expert Moderator MVP
Well, first, you used the field name Date in your SQL statement but your post says the field is named dateofpurchase.
Jan 14 '11 #4
neelmukhopadhya
23 New Member
datatype of the field is Datetime. and the column name is purchasedate as an example, You can take this as Date as the coulmn name.
Jan 14 '11 #5
guillermobytes
77 New Member
have you tried with your date formatted as '2010-01-12'
Jan 14 '11 #6
neelmukhopadhya
23 New Member
yes , i have used it.
but no result
Jan 14 '11 #7
Rabbit
12,516 Recognized Expert Moderator MVP
Have you tried using CONVERT() to make it a date time?
Jan 14 '11 #8
neelmukhopadhya
23 New Member
yes i have used it, but same result. Can you give me an example
Jan 14 '11 #9
Rabbit
12,516 Recognized Expert Moderator MVP
Expand|Select|Wrap|Line Numbers
  1. WHERE dateField = CONVERT(datetime, '1/1/2009')
Jan 14 '11 #10
guillermobytes
77 New Member
what is the output of the query :
Expand|Select|Wrap|Line Numbers
  1. select * from Point_item_master where PointName='ABC'
?

how is the date formatted?

try copying the date result form the query i show you, then take the date column name and try creating a new query with the date column name and date result in the where clause and see what happens.
Jan 14 '11 #11
neelmukhopadhya
23 New Member
DATE IS FORMATTED AS 11/01/2011 12:00:00 AM IN THE DATABASE.
I think sql server stores datetime in that format.i have also tried with the same format as of you . i am not getting the result.
Jan 20 '11 #12
neelmukhopadhya
23 New Member
i am getting the as result by executing the query as
select * from Point_item_master where PointName='ABC'
but whenever i am using the result i am not getting any result.

below is the line which i got from querying with pointname.
first column is the interger field. 2nd column is the datetime field. 3rd column is the string field. next column is the interger field.

1 2011-01-11 00:00:00.000 NEPAKULI 1129
Jan 20 '11 #13

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

Similar topics

0
4198
by: Q. John Chen | last post by:
Using MySQL control center, I created a MySQL database table with a column of Date type. It always give the a Default value (0000-00-00) even null is allowed. I tried remove the default value and...
1
1838
by: gostroff | last post by:
Hi, I have a lot of sample records done on different dates. It's easy to get the maximum value for any sample parameter for any sample location, but what if I want the date it was found? For...
2
2777
by: Enosh Chang | last post by:
Hi all, I have a question about optional parameter. If I use optional parameter, it ask me to set default value for it. How can I set default value for Date parameter? Thanks! Best Regards
2
9549
by: yxq | last post by:
There are 8 bytes binary value stored date and time in Registry. 84 8B D7 DF 8B 28 C5 01 I want to convert the binary value to date using VB.NET. Dim a As FILETIME a.dwHighDateTime = 29698187...
1
8511
by: hemant123 | last post by:
Hi I am trying to insert null value in date field using vbasic textbox.I tried various options but failed.Please tell me the solution. Thanks in advance. Hemant
1
1460
by: jane2007 | last post by:
Hello, Here is my current code ... Dim rstStk As Recordset Set rstStk = CurrentDb.OpenRecordset("Select * from stk where PartNum = '" & strPrt & "'") The problem with this code is that i...
0
1647
by: coolvivek33 | last post by:
hi i am facing a strange problem i am trying to build report using sql server 2005 and microsoft visual studio2005 now it is in requirement that i should seperate date from time.I have done that...
7
2257
by: metalheadstorm | last post by:
God this is annoying me, im sorry if this has been asked before but ive looked though the forum and the net but my searches havent come up woth anything.... mainly due to that i dont really ...
1
1963
by: codferrow | last post by:
Hello, I have a small issue with a web-search engine I'm working on. The main table is constantly growing (1 insert per second, currently 150 000 records) and it has full-text indexes on 2 fields...
5
1583
by: Greg (codepug | last post by:
I have a table that contains a field called RDATE (reminder date). Dates are optionally entered to remind a user of an upcoming event. I have a reminder button that launches a popup form, and a...
0
7328
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7388
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7049
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7499
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5631
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5055
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
4709
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3186
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
767
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.