🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.interbase.sql
Article #11014

Re: Insert date/time on trigger

#11014
From: Wayne Niddery [TeamB]
Date: Mon, 23 Dec 2002 17:20
32 lines
1914 bytes
"Rim Ranshuijsen" <rim@novicom.nl> wrote in message
news:3e060c20$1@newsgroups.borland.com...
>
> i'm using D6 and Interbase 6
> I want to insert the system time from database server when a new record is
> inserted, so i tried the folowing trigger:
>
> SET TERM !! ;
> CREATE TRIGGER DOCUMENT_INSERT_DATE FOR DOCUMENTS
>  BEFORE INSERT AS
>  BEGIN
>   NEW.INSERTDATE = date();
>  END !!
>
> SET TERM ; !!

Change "date()" to CURRENT_DATE.

Note that you can set this up as a default value for the field in the table
definition so you don't need a trigger:

CREATE TABLE MYTABLE (
KEY INTEGER NOT NULL,
INSERTDATE DATE NOT NULL DEFAULT CURRENT_DATE
)


--
Wayne Niddery - Logic Fundamentals, Inc. (www.logicfundamentals.com)
RADBooks: http://www.logicfundamentals.com/RADBooks/delphibooks.html
"The only reason some people get lost in thought is because it's unfamiliar
territory." - Paul Fix
Technical Details
Message-ID: <3e074682$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!uunet!dca.uu.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <3e060c20$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 114a0e,f09676422c57901b
X-Google-Attributes: gid114a0e,public
X-Google-ArrivalTime: 2002-12-23 09:32:15 PST
From: "Wayne Niddery [TeamB]" <wniddery@chaff.aci.on.ca>
Newsgroups: borland.public.interbase.sql
References: <3e060c20$1@newsgroups.borland.com>
Subject: Re: Insert date/time on trigger
Date: Mon, 23 Dec 2002 12:20:36 -0500
Lines: 34
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 209.50.82.158
Message-ID: <3e074682$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1040664194 209.50.82.158 (23 Dec 2002 09:23:14 -0800)
X-Authenticated-User: wniddery
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!uunet!dca.uu.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail