Re: updated the record being inserted using trigger
- From: bret@xxxxxxxxxx
- Date: Thu, 25 Oct 2007 18:10:45 -0700
On Oct 25, 4:56 pm, sai <go2...@xxxxxxxxx> wrote:
Hi All,
I am trying to update the record being inserted using a trigger, but
sybase doesn't seem to allow it, Can anyone suggest an alternative
here is what i am trying to do
create trigger tr1 on xyz for insert as
begin
update inserted set field3=field1, field4=field2
end
go
Thanks
Sai
You can certainly update the row you inserted in an insert trigger -
however, you have to insert the row in the base table. "inserted" is
a read-only pseudo table.
Instead, write the trigger like:
create trigger tr on xyz for insert as
update xyz set field 3 = field 1, field 4 = field2 from xyz, inserted
i where xyz.primarykey = i.primarykey
.
- Follow-Ups:
- References:
- Prev by Date: updated the record being inserted using trigger
- Next by Date: Re: Creation of a script for the account of time
- Previous by thread: updated the record being inserted using trigger
- Next by thread: Re: updated the record being inserted using trigger
- Index(es):
Relevant Pages
|
|