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.

INSTEAD OF problem

2 posts in Trigger Last posting was on 2004-07-20 11:28:31.0Z
graeme gorman Posted on 2004-07-20 11:25:11.0Z
From: "graeme gorman" <nospamthanksgraeme_gorman@yahoo.co.uk>
Newsgroups: advantage.trigger
Subject: INSTEAD OF problem
Date: Tue, 20 Jul 2004 12:25:11 +0100
Lines: 27
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
NNTP-Posting-Host: 82.152.50.209
Message-ID: <40fd029b@solutions.advantagedatabase.com>
X-Trace: 20 Jul 2004 05:31:39 -0700, 82.152.50.209
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!82.152.50.209
Xref: solutions.advantagedatabase.com Advantage.Trigger:85
Article PK: 1136153

hi

i want to be able to set some fields in a table that have a timestamp to be
when the record is posted to that. But i can't use before or after insert.
but if i used instead of the trigger makes lots of records :-(

what should i do?

I'm guessing its to do with the INSERT INTO refiring the trigger. Also the
table has an AUTOINC field and this seems to get to the same number for all
the records that the trigger inserts!!! my trigger code is
UPDATE __new SET posted_date = NOW();
UPDATE __new SET last_reply_date = NOW();

INSERT INTO messageboard_messages
("subject","message","forum_id","user_name","posted_date","replies","views",
"last_reply_date","is_main_post","parent_message_id","ip_address","url","url
_description") SELECT
"subject","message","forum_id","user_name","posted_date","replies","views","
last_reply_date","is_main_post","parent_message_id","ip_address","url","url_
description" FROM __new;

any help would be gratefully
thanks
graeme


graeme gorman Posted on 2004-07-20 11:28:31.0Z
From: "graeme gorman" <nospamthanksgraeme_gorman@yahoo.co.uk>
Newsgroups: advantage.trigger
References: <40fd029b@solutions.advantagedatabase.com>
Subject: Re: INSTEAD OF problem
Date: Tue, 20 Jul 2004 12:28:31 +0100
Lines: 45
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
NNTP-Posting-Host: 82.152.50.209
Message-ID: <40fd0364@solutions.advantagedatabase.com>
X-Trace: 20 Jul 2004 05:35:00 -0700, 82.152.50.209
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!82.152.50.209
Xref: solutions.advantagedatabase.com Advantage.Trigger:86
Article PK: 1136152

Hey

I was being stooopid I just set the default value to now() and it works
fine!!

doh!!!

"graeme gorman" <nospamthanksgraeme_gorman@yahoo.co.uk> wrote in message
news:40fd029b@solutions.advantagedatabase.com...
> hi
>
> i want to be able to set some fields in a table that have a timestamp to
be
> when the record is posted to that. But i can't use before or after insert.
> but if i used instead of the trigger makes lots of records :-(
>
> what should i do?
>
> I'm guessing its to do with the INSERT INTO refiring the trigger. Also the
> table has an AUTOINC field and this seems to get to the same number for
all
> the records that the trigger inserts!!! my trigger code is
> UPDATE __new SET posted_date = NOW();
> UPDATE __new SET last_reply_date = NOW();
>
> INSERT INTO messageboard_messages
>
("subject","message","forum_id","user_name","posted_date","replies","views",
>
"last_reply_date","is_main_post","parent_message_id","ip_address","url","url
> _description") SELECT
>
"subject","message","forum_id","user_name","posted_date","replies","views","
>
last_reply_date","is_main_post","parent_message_id","ip_address","url","url_
> description" FROM __new;
>
> any help would be gratefully
> thanks
> graeme
>
>