Board index » delphi » to cut into parts a timestamp fields in sql statement

to cut into parts a timestamp fields in sql statement

Hi everybody...
which function does give me date or time part of a timestamp field?
When I work with db2, I use following function:
select ...... where date(trx_date)='11/11/1111'
It hasn't worked on ib.
Could you help me about this?
thanks...
 

Re:to cut into parts a timestamp fields in sql statement


Not tested, but I think this would work:

select cast(timestampcolumn as date) from sometable

--
Martijn Tonies
Upscene Productions

InterBase Workbench - The Developer Tool for InterBase
http://www.interbaseworkbench.com

"Volkan Karaboea" <volkankarab...@hotmail.com> schreef in bericht
news:3bdfd4e7_1@dnews...

Quote
> Hi everybody...
> which function does give me date or time part of a timestamp field?
> When I work with db2, I use following function:
> select ...... where date(trx_date)='11/11/1111'
> It hasn't worked on ib.
> Could you help me about this?
> thanks...

Re:to cut into parts a timestamp fields in sql statement


Quote
> which function does give me date or time part of a timestamp field?
> When I work with db2, I use following function:
> select ...... where date(trx_date)='11/11/1111'

If you prefer IB to use index for such query, use
  select ...... where trx_date>='11/11/1111' AND trx_date<'11/12/1111'

--
Ivan
http://www.volny.cz/iprenosil/interbase

Re:to cut into parts a timestamp fields in sql statement


Thanks Martijn it has worked.

Quote
Martijn Tonies <m.ton...@upscene.com> wrote in message

news:3bdfdc57_1@dnews...
Quote
> Not tested, but I think this would work:

> select cast(timestampcolumn as date) from sometable

> --
> Martijn Tonies
> Upscene Productions

> InterBase Workbench - The Developer Tool for InterBase
> http://www.interbaseworkbench.com

> "Volkan Karaboea" <volkankarab...@hotmail.com> schreef in bericht
> news:3bdfd4e7_1@dnews...
> > Hi everybody...
> > which function does give me date or time part of a timestamp field?
> > When I work with db2, I use following function:
> > select ...... where date(trx_date)='11/11/1111'
> > It hasn't worked on ib.
> > Could you help me about this?
> > thanks...

Other Threads