NexusDB Newsgroups

NexusDB Newsgroups (http://www.nexusdb.com/forums/index.php)
-   nexusdb.public.support.adoprovider (http://www.nexusdb.com/forums/forumdisplay.php?f=10)
-   -   How do I get current date and time (http://www.nexusdb.com/forums/showthread.php?t=693)

Matthew Balraj 26th May 2010 10:24 PM

How do I get current date and time
 
Hi

In SQL 2005 Select getdate() would return the current date and
time. What is the equivalent in NexusDB.

I want to use it in an After insert trigger to populate a time stamp field

Thanks
Matthew



Franz-Leo Chomse [NDX] 26th May 2010 11:52 PM

Re: How do I get current date and time
 
On Wed, 26 May 2010 15:54:14 +0530, "Matthew Balraj" <matt@gislen.com>
wrote:

>Hi
>
>In SQL 2005 Select getdate() would return the current date and
>time. What is the equivalent in NexusDB.
>
>I want to use it in an After insert trigger to populate a time stamp field


Using a TnxCurrentDateTimeDefaultValueDescriptor for both Insert and
Update - This gives the desired result without any coding


Regards from Germany

Franz-Leo Chomse [NexusDB Expert]
franz.leo.chomse@ndx.nexusdb_x.com (please remove "_x" to reply)

Hannes Danzl[NDD] 27th May 2010 08:32 AM

Re: How do I get current date and time
 
Matthew Balraj wrote:

> Hi
>
> In SQL 2005 Select getdate() would return the current date and
> time. What is the equivalent in NexusDB.
>
> I want to use it in an After insert trigger to populate a time stamp field


In the manual:
http://www.nexusdb.com/support/index...efunctions.htm

--

Hannes Danzl / NexusDB

Issue Tracker - http://www.nexusdb.com/mantis/view_all_bug_page.php
Newsgroup Web Gateway - http://www.nexusdb.com/forums/
Newsgroup Search - http://www.nexusdb.com/forums/search.php

Will Owyong [NDX] 27th May 2010 10:52 AM

Re: How do I get current date and time
 
"Matthew Balraj" <matt@gislen.com> wrote in message
news:4bfcf7a3@DSVR011613....
> Hi
>
> In SQL 2005 Select getdate() would return the current date and
> time. What is the equivalent in NexusDB.
>
> I want to use it in an After insert trigger to populate a time stamp field
>
> Thanks
> Matthew


current_date
current_timestamp
current_time
E.g. select current_timestamp from #dummy;

Alternatively you could modify the table in Enterprise Manager to populate
the timestamp field on insert via the data dictionary, potentially removing
the need for the trigger (if that is all you use it for).

When _creating_ a new table, this can be done in SQL as:
drop table if exists mytable;
create table mytable (
....
tstampField timestamp default current_timestamp,
....etc.
);

--
Regards
Will Owyong [NDX]
Newcastle, NSW, AUSTRALIA
GMT+10



Matthew Balraj 27th May 2010 10:58 PM

Re: How do I get current date and time
 
Thank you Guys

A special thanks to Will Owyong whose suggestion was just what was needed to
be done

"Matthew Balraj" <matt@gislen.com> wrote in message
news:4bfcf7a3@DSVR011613....
> Hi
>
> In SQL 2005 Select getdate() would return the current date and
> time. What is the equivalent in NexusDB.
>
> I want to use it in an After insert trigger to populate a time stamp field
>
> Thanks
> Matthew
>
>





All times are GMT +11. The time now is 03:58 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.