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.

On Conflict Trigger

2 posts in Trigger Last posting was on 2006-12-14 19:21:19.0Z
"Mike Wilcock" <mike.wilcock Posted on 2006-12-11 14:55:22.0Z
Reply-To: "Mike Wilcock" <mike.wilcock@<nospam>stanfordtec.co.uk>
From: "Mike Wilcock" <mike.wilcock@<nospam>stanfordtec.co.uk>
Newsgroups: Advantage.Trigger
Subject: On Conflict Trigger
Date: Mon, 11 Dec 2006 14:55:22 -0000
Lines: 22
Organization: Stanford Technologies Limited
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.3790.2663
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.2757
NNTP-Posting-Host: 91.84.24.61
Message-ID: <457d6f8b@solutions.advantagedatabase.com>
X-Trace: 11 Dec 2006 07:47:39 -0700, 91.84.24.61
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!91.84.24.61
Xref: solutions.advantagedatabase.com Advantage.Trigger:291
Article PK: 1136357

Hi,

I am trying to create an on conflict trigger, but due to my poor SQL skills
have hit a bit of a brick wall;( Here's what I'd like to acheive...

All of the tables in my data dictionary contain a "DATETIME" charachter
field (All tables are dbf/cdx) which gets updated by update and insert
triggers. I am trying to create an on conflict trigger which will evaluate
the datetime field and apply the last update when there is a conflict. The
trigger will also write the data of the failed row to a conflicts ADT table
along with a date time, rowversion etc. This way I will have consisten data
at both ends and be able to audit any conflicts which may occur.

I was wondering if anybody could give me some kind of example(s) of how this
could be done in SQL just to point me in the right direction.

Thanks in advance,


Mike


James Johnston (ADS Support) Posted on 2006-12-14 19:21:19.0Z
From: "James Johnston \(ADS Support\)" <email@nospam.com>
Newsgroups: Advantage.Trigger
References: <457d6f8b@solutions.advantagedatabase.com>
Subject: Re: On Conflict Trigger
Date: Thu, 14 Dec 2006 12:21:19 -0700
Lines: 35
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2869
X-RFC2646: Format=Flowed; Response
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962
NNTP-Posting-Host: 10.24.34.182
Message-ID: <4581a333@solutions.advantagedatabase.com>
X-Trace: 14 Dec 2006 12:17:07 -0700, 10.24.34.182
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!10.24.34.182
Xref: solutions.advantagedatabase.com Advantage.Trigger:292
Article PK: 1136359

Mike-

You can use a IF statement to take care of this. Just compare the __old and
the __new DATETIME fields and whichever one is bigger, do the update
statement with that. Check out our help file for information on IF as well
as TimeStamp to do comparisons on the datetime field.

James

"Mike Wilcock stanfordtec.co.uk>" <mike.wilcock@<nospam> wrote in message
news:457d6f8b@solutions.advantagedatabase.com...
> Hi,
>
> I am trying to create an on conflict trigger, but due to my poor SQL
> skills have hit a bit of a brick wall;( Here's what I'd like to
> acheive...
>
> All of the tables in my data dictionary contain a "DATETIME" charachter
> field (All tables are dbf/cdx) which gets updated by update and insert
> triggers. I am trying to create an on conflict trigger which will
> evaluate the datetime field and apply the last update when there is a
> conflict. The trigger will also write the data of the failed row to a
> conflicts ADT table along with a date time, rowversion etc. This way I
> will have consisten data at both ends and be able to audit any conflicts
> which may occur.
>
> I was wondering if anybody could give me some kind of example(s) of how
> this could be done in SQL just to point me in the right direction.
>
> Thanks in advance,
>
>
> Mike
>