Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Date functions

 
sachin komurlekar
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
SELECT * FROM EMP WHERE DOJ > '12-JAN-82'
The above query returns all the rows present in the table.
Where as it should show only three records according to the rows inserted.
what could be the problem?
Please Give me the code if possible and how do I use the date functions in jdbc while comparing recordin the database(Msaccess)?

 
Daniel Dunleavy
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I assume your DOJ is defined as a date or timestamp field in the database. You have to do some kind of conversion on the string before comparing.... to_date in oracle cvdate in access
You can just pass the strings and have the prepared sql statement do the conversion and comparision
.... where doj > cvdate(instring)
 
sachin komurlekar
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
dear,
Daniel Dunleavy
i have used cvdate in my program,but it is giving error that the method cvdate is not found in the program.
i have used create statement.
i have imported both java.util.date & java.sql.date in my class.
please help me as soon as possible.
please give me the code.
sachin
------------------
 
Daniel Dunleavy
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The cvdate is for access and is used in the select statement
select * from tb1 where testdate > cvdate('12-JAN-82')
Dan
 
Xavier VS
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
use #date# while writing ur SQl for MS-Acess.
xavier
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic