|
Log in | ||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
I want to use sql to get the date from a datetime field. I have written
Select Date(B.EventDate) From HistoricalEvents as B; but it does not work. What is the correct syntax? |
|
#2
|
|||
|
|||
|
<< What is the correct syntax? >>
select cast(B.EventDate as date) EventDate from HistoricalEvents B Ole Willy Tuv |
|
#3
|
|||
|
|||
|
Mark Clark wrote:
> I want to use sql to get the date from a datetime field. I have written > Select Date(B.EventDate) From HistoricalEvents as B; but it does not > work. What is the correct syntax? > Hmm round() is supposed to take away the time portion of a datetime and return just the date but seems to return a numeric value instead. SELECT ROUND(B.EventDate) from HistoricalEvents B; Should work to chop off the time portion of a date but currently doesn't. Brian Evans |
|
#4
|
|||
|
|||
|
Brian Evans wrote:
> Mark Clark wrote: > >> I want to use sql to get the date from a datetime field. I have >> written Select Date(B.EventDate) From HistoricalEvents as B; but it >> does not work. What is the correct syntax? >> > > Hmm round() is supposed to take away the time portion of a datetime > and return just the date but seems to return a numeric value instead. > > SELECT ROUND(B.EventDate) from HistoricalEvents B; > > Should work to chop off the time portion of a date but currently > doesn't. > > Brian Evans Opps ROUND is bad to use since it rounds up sometimes. I usually use TRUNC() in oracle which NexusDB doesn't have. In Nexus use FLOOR() which in fact does return a date when the arguement is a date. SELECT FLOOR(B.EventDate) from HistoricalEvents B; Brian Evans |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| SQL Statement for DateTime Field | Carsten Groh | nexusdb.public.support.php | 2 | 27th April 2009 11:46 PM |
| Selecting on Date Field Problem | AJ | nexusdb.public.support.odbc | 2 | 24th March 2007 09:12 AM |
| ReportBuilder 7 - doesn't like date/ datetime parameters via RB Explorer | William O. | nexusdb.public.support.thirdparty | 7 | 13th June 2006 05:11 PM |
| Selecting the Month of a datetime field | Germain Cassiere | nexusdb.public.support.sql | 1 | 22nd November 2003 01:05 AM |
| Assigning NULL to a Prepared SQL DateTime Field | M. Said | nexusdb.public.support.sql | 5 | 1st October 2003 07:26 AM |