Create a cursor (see Books Online for more info) against the Deleted and
Inserted tables. Unless you've guaranteed only one record at a time
insertion/deletion, always assume multi-record inserts/deletes.
Good luck,
krf
"Harun Bolat" <harun...@kaynet.net> wrote in message
news:3d6f...@newsgroups.borland.com...
> Hi,
> I try to write update trigger on MsSQL server2000 . but I don't know how
> can I manage
> Inserted or Deleted table when more than one rows affected.
If you could do the same with deletes and inserts
then its probably worth a try as the cursor option is
heavy on resources.
Something like :
delete from tablelog
from deleted d
where tablelog.number=d.number
insert into tablelog
select * from inserted
Sunil
"Harun Bolat" <harun...@kaynet.net> wrote:
>Hi,
> I try to write update trigger on MsSQL server2000 . but I don't know how
>can I manage
>Inserted or Deleted table when more than one rows affected.
>I try to get values that user update but everytime I get only last row that
>is affected .
>for Example in this stament
> SELECT @NUMBER = NUMBER ,@NAME = NAME, @SURNAME = SURNAME FROM
>INSERTED
>
>all local variable get only last value in the inserted table.
>
>It is so important for me .
>thanks.
>
>CREATE TRIGGER UPDATE_TRG ON TABLE1
>FOR UPDATE
>AS
> DECLARE
> @NUMBER INTEGER,
> @OLDNUMBER INTEGER,
> @NAME VARCHAR(20),
> @SURNAM VARCHAR(20),
>
> SELECT @NUMBER = NUMBER ,@NAME = NAME, @SURNAME = SURNAME FROM
>INSERTED
>
> SELECT @OLDNUMBER = NUMBER FROM DELETED
>
> UPDATE TABLELOG SET NAME = @NAME, SURNAME = @SOYADI, NUMBER = @NUMBER
> WHERE NUMBER = @OLDNUMBER
>
>END
>
>
>
Am not a SQL Server 2000 user, but does not SQL Server 2000
support row level triggers ?
Ty,
Sunil
if Update(FirstName)
...
Not the same thing, but definiatly usable.
krf
"Sunil Furtado" <su...@furtado.de> wrote in message
news:3d6f6c51$1...@newsgroups.borland.com...