Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

copying fields to backup table in trigger

2 posts in Trigger Last posting was on 2008-07-25 19:47:31.0Z
keith crusius Posted on 2008-07-25 17:58:12.0Z
From: "keith crusius" <noemail@noemail.com>
Newsgroups: Advantage.Trigger
Subject: copying fields to backup table in trigger
Date: Fri, 25 Jul 2008 12:58:12 -0500
Lines: 6
MIME-Version: 1.0
Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Windows Mail 6.0.6000.16480
X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6000.16545
NNTP-Posting-Host: 72.179.176.48
Message-ID: <488a1324@solutions.advantagedatabase.com>
X-Trace: 25 Jul 2008 11:53:40 -0700, 72.179.176.48
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!72.179.176.48
Xref: solutions.advantagedatabase.com Advantage.Trigger:402
Article PK: 1136467

I'm writing a before delete trigger to copy the record to an archive table.
Is there a simple way to copy all the fields between the two tables without
explicitly writing out each and every field to insert into and select from?
The tables will always have identical fields except that the archive table
has a modtime field added to it. TIA.


Thomas Steinmaurer Posted on 2008-07-25 19:47:31.0Z
Date: Fri, 25 Jul 2008 21:47:31 +0200
From: Thomas Steinmaurer <t.steinmaurer_dontbugmewithspam_@upscene.com>
User-Agent: Thunderbird 2.0.0.16 (Windows/20080708)
MIME-Version: 1.0
Newsgroups: Advantage.Trigger
Subject: Re: copying fields to backup table in trigger
References: <488a1324@solutions.advantagedatabase.com>
In-Reply-To: <488a1324@solutions.advantagedatabase.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 86.56.229.75
Message-ID: <488a2c5b@solutions.advantagedatabase.com>
X-Trace: 25 Jul 2008 13:41:15 -0700, 86.56.229.75
Lines: 24
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!86.56.229.75
Xref: solutions.advantagedatabase.com Advantage.Trigger:403
Article PK: 1136463


> I'm writing a before delete trigger to copy the record to an archive
> table. Is there a simple way to copy all the fields between the two
> tables without explicitly writing out each and every field to insert
> into and select from? The tables will always have identical fields
> except that the archive table has a modtime field added to it. TIA.

Not tested, but something along the line

insert into archive_table
select current_timestamp, n.* from __new n;


should work. Assumed, the modtime field is the first field in the
archive table.


--
Best Regards,
Thomas Steinmaurer
LogManager Series - Logging/Auditing Suites supporting
InterBase, Firebird, Advantage Database, MS SQL Server and
NexusDB V2
Upscene Productions
http://www.upscene.com