Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 19th, 2005, 11:20 PM
George Dainis
Guest
 
Posts: n/a
Default Comparing DATE with TIMESTAMP fields possible ?

In my database table there is a datetime column which can obviously contain a timestamp
(in the format YYYY-MM-DD HH:MM:SS.NNN).

Now I want to get all those records which have a date of lets say 2005-02-03 regardsless of
their time value.

Ok, I could do this by statement like

SELECT * FROM MYTAB WHERE MYDATE >= '2005-02-03 00:00:00.000' AND MYDATE <= '2005-02-03 23:59.59.999'

but this is rather inconvenient. I feel that there must be a shorter version like

SELECT * FROM MYTAB WHERE MYDATE = '2005-02-03 **:**:**.***'

or a built-in fuction like:

SELECT * FROM MYTAB WHERE datepartonly(MYDATE) = '2005-02-03'

How does this work?

George

 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles