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.

Update Trigger to keep the last modification times current! Sybase 7.0.1- need help

6 posts in General Discussion Last posting was on 2003-08-04 12:42:29.0Z
Matani Posted on 2003-08-01 11:26:19.0Z
Reply-To: "Matani" <S.Matani@ads-tec.de>
From: "Matani" <saleh@matani.net>
Newsgroups: ianywhere.public.general
Subject: Update Trigger to keep the last modification times current! Sybase 7.0.1- need help
Lines: 8
Organization: sudent
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: gabriel.le1.ads-tec.de
X-Original-NNTP-Posting-Host: gabriel.le1.ads-tec.de
Message-ID: <3f2a4e5b$1@forums-1-dub>
Date: 1 Aug 2003 04:26:19 -0700
X-Trace: forums-1-dub 1059737179 62.153.239.43 (1 Aug 2003 04:26:19 -0700)
X-Original-Trace: 1 Aug 2003 04:26:19 -0700, gabriel.le1.ads-tec.de
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:1499
Article PK: 3729

how can i create a Trigger witch update the last-modified time on updated
row ?

thank you!

M.


"Hoeppner, Karsten" <hoe.de Posted on 2003-08-01 13:00:27.0Z
From: "Hoeppner, Karsten" <hoe.de@KHoeppner.NO__SPAM>
Newsgroups: ianywhere.public.general
Subject: Re: Update Trigger to keep the last modification times current! Sybase 7.0.1- need help
Organization: ECLiPSE
Message-ID: <tmokivkving1j9ul4gb6iuf13ku5elg1vk@4ax.com>
References: <3f2a4e5b$1@forums-1-dub>
X-Newsreader: Forte Agent 1.93/32.576 English (American)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: pd9e176ee.dip.t-dialin.net
X-Original-NNTP-Posting-Host: pd9e176ee.dip.t-dialin.net
Date: 1 Aug 2003 06:00:27 -0700
X-Trace: forums-1-dub 1059742827 217.225.118.238 (1 Aug 2003 06:00:27 -0700)
X-Original-Trace: 1 Aug 2003 06:00:27 -0700, pd9e176ee.dip.t-dialin.net
Lines: 25
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:1500
Article PK: 3730

Hi Matani,

you can create your a special column for example :

"...
last_updated timestamp default timestamp,
...
"

You don't need a trigger to get this information.

HTH,
Karsten Hoeppner
[Hermann O. Eckert GmbH]

On 1 Aug 2003 04:26:19 -0700, "Matani" <saleh@matani.net> wrote:

>how can i create a Trigger witch update the last-modified time on updated
>row ?
>
>thank you!
>
>M.
>


Matani Posted on 2003-08-01 13:17:25.0Z
Reply-To: "Matani" <S.Matani@ads-tec.de>
From: "Matani" <saleh@matani.net>
Newsgroups: ianywhere.public.general
References: <3f2a4e5b$1@forums-1-dub> <tmokivkving1j9ul4gb6iuf13ku5elg1vk@4ax.com>
Subject: Re: Update Trigger to keep the last modification times current! Sybase 7.0.1- need help
Lines: 35
Organization: sudent
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: gabriel.le1.ads-tec.de
X-Original-NNTP-Posting-Host: gabriel.le1.ads-tec.de
Message-ID: <3f2a6865$1@forums-1-dub>
Date: 1 Aug 2003 06:17:25 -0700
X-Trace: forums-1-dub 1059743845 62.153.239.43 (1 Aug 2003 06:17:25 -0700)
X-Original-Trace: 1 Aug 2003 06:17:25 -0700, gabriel.le1.ads-tec.de
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:1501
Article PK: 3731

Sorry , but i can not understand what you mean!
yes i can crate a column witch get the current Timestamp ,but how to update
this column when any column of this row has been changed or updated ?

Matani.

"Hoeppner, Karsten" <hoe.de@KHoeppner.NO__SPAM> schrieb im Newsbeitrag
news:tmokivkving1j9ul4gb6iuf13ku5elg1vk@4ax.com...

> Hi Matani,
>
> you can create your a special column for example :
>
> "...
> last_updated timestamp default timestamp,
> ...
> "
>
> You don't need a trigger to get this information.
>
> HTH,
> Karsten Hoeppner
> [Hermann O. Eckert GmbH]
>
> On 1 Aug 2003 04:26:19 -0700, "Matani" <saleh@matani.net> wrote:
>
> >how can i create a Trigger witch update the last-modified time on updated
> >row ?
> >
> >thank you!
> >
> >M.
> >
>


Greg Fenton Posted on 2003-08-01 14:05:50.0Z
From: Greg Fenton <greg.fenton_NOSPAM_@ianywhere.com>
Organization: iAnywhere Solutions Inc.
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4; MultiZilla v1.4.0.4A) Gecko/20030624
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: ianywhere.public.general
Subject: Re: Update Trigger to keep the last modification times current! Sybase 7.0.1- need help
References: <3f2a4e5b$1@forums-1-dub> <tmokivkving1j9ul4gb6iuf13ku5elg1vk@4ax.com> <3f2a6865$1@forums-1-dub>
In-Reply-To: <3f2a6865$1@forums-1-dub>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: gfenton-xp.sybase.com
X-Original-NNTP-Posting-Host: gfenton-xp.sybase.com
Message-ID: <3f2a73be$1@forums-1-dub>
Date: 1 Aug 2003 07:05:50 -0700
X-Trace: forums-1-dub 1059746750 172.31.140.253 (1 Aug 2003 07:05:50 -0700)
X-Original-Trace: 1 Aug 2003 07:05:50 -0700, gfenton-xp.sybase.com
Lines: 35
X-Authenticated-User: techsupp
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:1502
Article PK: 3732


Matani wrote:
> Sorry , but i can not understand what you mean!
> yes i can crate a column witch get the current Timestamp ,but how to update
> this column when any column of this row has been changed or updated ?
>

Take a look at the ASA 8.0.x online docs. Look in the index for
"DEFAULT TIMESTAMP columns". That takes you to the CREATE TABLE
statement page, which says:

When a column is declared with DEFAULT TIMESTAMP, a default value is
provided for inserts, and the value is updated with the current date
and time whenever the row is updated.

To provide a default value on insert, but not update the column
whenever the row is updated, use DEFAULT CURRENT TIMESTAMP instead
of DEFAULT TIMESTAMP.

So as Karsten said, if you define your column as:

last_modified TIMESTAMP DEFAULT TIMESTAMP

then the value is modified everytime an INSERT or UPDATE to *any* part
of the row occurs (unless you update the last_modified value directly).

Hope this helps,
greg.fenton
--
Greg Fenton
Consultant, Solution Services, iAnywhere Solutions
--------
Visit the iAnywhere Solutions Developer Community
Whitepapers, TechDocs, Downloads
http://www.ianywhere.com/developer/


Breck Carter [TeamSybase] Posted on 2003-08-01 15:11:13.0Z
From: "Breck Carter [TeamSybase]" <NOSPAM__bcarter@risingroad.com>
Newsgroups: ianywhere.public.general
Subject: Re: Update Trigger to keep the last modification times current! Sybase 7.0.1- need help
Organization: RisingRoad Professional Services
Reply-To: NOSPAM__bcarter@risingroad.com
Message-ID: <ba0livk35nbslf4lhdo0045k69abjc5um7@4ax.com>
References: <3f2a4e5b$1@forums-1-dub> <tmokivkving1j9ul4gb6iuf13ku5elg1vk@4ax.com> <3f2a6865$1@forums-1-dub>
X-Newsreader: Forte Agent 1.8/32.548
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: nnc010.canpar.ca
X-Original-NNTP-Posting-Host: nnc010.canpar.ca
Date: 1 Aug 2003 08:11:13 -0700
X-Trace: forums-1-dub 1059750673 204.225.91.186 (1 Aug 2003 08:11:13 -0700)
X-Original-Trace: 1 Aug 2003 08:11:13 -0700, nnc010.canpar.ca
Lines: 73
X-Authenticated-User: TeamPS
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:1503
Article PK: 3733

That's what "default timestamp" does. Here is an excerpt from SQL
Anywhere 9 Developers Guide to be published in Q1 2004:

=====
1.19 Special Update Defaults

SQL Anywhere offers three special DEFAULT values that apply to update
operations as well as insert, when explicit column values are not
provided. Unlike the special literals described earlier, these special
values can only be used as DEFAULT values.

<special_update_default> ::= LAST USER

| TIMESTAMP

| UTC TIMESTAMP

DEFAULT LAST USER returns the VARCHAR ( 128 ) user ID of the current
connection. This answers the question "who was the person who inserted
or updated this row?"

DEFAULT TIMESTAMP returns a TIMESTAMP value containing the current
date and time, to answer the question "when was this row inserted or
updated?"

DEFAULT UTC TIMESTAMP works the same way as DEFAULT TIMESTAMP, with an
adjustment for Coordinated Universal Time.

These special update defaults can be used to implement simple audit
trails without writing any special trigger logic. DEFAULT TIMESTAMP is
especially valuable in a MobiLink distributed environment to answer
the question, "does this row need to be downloaded because it was
inserted or updated since the last synchronization?"
=====

On 1 Aug 2003 06:17:25 -0700, "Matani" <saleh@matani.net> wrote:

>Sorry , but i can not understand what you mean!
>yes i can crate a column witch get the current Timestamp ,but how to update
>this column when any column of this row has been changed or updated ?
>
>Matani.
>
>"Hoeppner, Karsten" <hoe.de@KHoeppner.NO__SPAM> schrieb im Newsbeitrag
>news:tmokivkving1j9ul4gb6iuf13ku5elg1vk@4ax.com...
>> Hi Matani,
>>
>> you can create your a special column for example :
>>
>> "...
>> last_updated timestamp default timestamp,
>> ...
>> "
>>
>> You don't need a trigger to get this information.
>>
>> HTH,
>> Karsten Hoeppner
>> [Hermann O. Eckert GmbH]
>>
>> On 1 Aug 2003 04:26:19 -0700, "Matani" <saleh@matani.net> wrote:
>>
>> >how can i create a Trigger witch update the last-modified time on updated
>> >row ?
>> >
>> >thank you!
>> >
>> >M.
>> >
>>
>

bcarter@risingroad.com
Mobile and Distributed Enterprise Database Applications
http://www.risingroad.com


Matani Posted on 2003-08-04 12:42:29.0Z
Reply-To: "Matani" <S.Matani@ads-tec.de>
From: "Matani" <saleh@matani.net>
Newsgroups: ianywhere.public.general
References: <3f2a4e5b$1@forums-1-dub> <tmokivkving1j9ul4gb6iuf13ku5elg1vk@4ax.com> <3f2a6865$1@forums-1-dub> <ba0livk35nbslf4lhdo0045k69abjc5um7@4ax.com>
Subject: Re: Update Trigger to keep the last modification times current! Sybase 7.0.1- need help
Lines: 81
Organization: sudent
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: gabriel.le1.ads-tec.de
X-Original-NNTP-Posting-Host: gabriel.le1.ads-tec.de
Message-ID: <3f2e54b5@forums-1-dub>
Date: 4 Aug 2003 05:42:29 -0700
X-Trace: forums-1-dub 1060000949 62.153.239.43 (4 Aug 2003 05:42:29 -0700)
X-Original-Trace: 4 Aug 2003 05:42:29 -0700, gabriel.le1.ads-tec.de
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:1518
Article PK: 3748

thank you

"Breck Carter [TeamSybase]" <NOSPAM__bcarter@risingroad.com> schrieb im
Newsbeitrag news:ba0livk35nbslf4lhdo0045k69abjc5um7@4ax.com...

> That's what "default timestamp" does. Here is an excerpt from SQL
> Anywhere 9 Developers Guide to be published in Q1 2004:
>
> =====
> 1.19 Special Update Defaults
>
> SQL Anywhere offers three special DEFAULT values that apply to update
> operations as well as insert, when explicit column values are not
> provided. Unlike the special literals described earlier, these special
> values can only be used as DEFAULT values.
>
> <special_update_default> ::= LAST USER
> | TIMESTAMP
> | UTC TIMESTAMP
>
> DEFAULT LAST USER returns the VARCHAR ( 128 ) user ID of the current
> connection. This answers the question "who was the person who inserted
> or updated this row?"
>
> DEFAULT TIMESTAMP returns a TIMESTAMP value containing the current
> date and time, to answer the question "when was this row inserted or
> updated?"
>
> DEFAULT UTC TIMESTAMP works the same way as DEFAULT TIMESTAMP, with an
> adjustment for Coordinated Universal Time.
>
> These special update defaults can be used to implement simple audit
> trails without writing any special trigger logic. DEFAULT TIMESTAMP is
> especially valuable in a MobiLink distributed environment to answer
> the question, "does this row need to be downloaded because it was
> inserted or updated since the last synchronization?"
> =====
>
> On 1 Aug 2003 06:17:25 -0700, "Matani" <saleh@matani.net> wrote:
>
> >Sorry , but i can not understand what you mean!
> >yes i can crate a column witch get the current Timestamp ,but how to
update
> >this column when any column of this row has been changed or updated ?
> >
> >Matani.
> >
> >"Hoeppner, Karsten" <hoe.de@KHoeppner.NO__SPAM> schrieb im Newsbeitrag
> >news:tmokivkving1j9ul4gb6iuf13ku5elg1vk@4ax.com...
> >> Hi Matani,
> >>
> >> you can create your a special column for example :
> >>
> >> "...
> >> last_updated timestamp default timestamp,
> >> ...
> >> "
> >>
> >> You don't need a trigger to get this information.
> >>
> >> HTH,
> >> Karsten Hoeppner
> >> [Hermann O. Eckert GmbH]
> >>
> >> On 1 Aug 2003 04:26:19 -0700, "Matani" <saleh@matani.net> wrote:
> >>
> >> >how can i create a Trigger witch update the last-modified time on
updated
> >> >row ?
> >> >
> >> >thank you!
> >> >
> >> >M.
> >> >
> >>
> >
>
> bcarter@risingroad.com
> Mobile and Distributed Enterprise Database Applications
> http://www.risingroad.com