p2p.wrox.com Forums

Need to download code?

View our list of code downloads.

  Return to Index  

sql_language thread: Date Function in SQL

Message #1 by Sri_core@m... on Tue, 26 Mar 2002 17:41:53
It is better to use 'between' when working with dates
eg: WHERE ... myDate BETWEEN 3/26/2002 00:00:00 AND 3/26/2002 23:59:59
I believe that when you give '3/26/2002', the server will convert that to
'3/26/2002 00:00:00'.

When working with dates in oracle I have needed to use a function in my SQL
command called to_date. This tells Oracle how to convert the text that you
are giving it into a date. You will have to look up the syntex for to_date
in an Oracle reference as I don't remember it.

John Lick
Sr. Software Developer

----- Original Message -----
From: <Sri_core@m...>
To: "sql language" <sql_language@p...>
Sent: Tuesday, March 26, 2002 5:41 PM
Subject: [sql_language] Date Function in SQL

> I want to write a query which is going to get me the records from a column
> for today's date. The column has got the date in this format 2002-03-26
> 00:00:00. When I say the
> Select* Blah from Blah where Blah=3/26/2002 it only shows one record.
> I want to pull the record from
> 1) SQL Server
> 2) Oracle DB
> Any help will be highly appreciated.
> Thanks
> Sri

  Return to Index