September 24, 2005 at 6:40 am
I got a view that gest information från a certain table. Then i got a trigger that should copy new information from this view to a specific table. How should this trigger know when new information has been inserted in the View?
CREATE TRIGGER copyRow
ON person_View
INSTEAD OF INSERT
AS
BEGIN
INSERT into kontakt (nr, telefon, adress)
values ('2', '3', '4')
commit transaction
END
September 26, 2005 at 1:47 am
If you're asking how you get the just inserted rows, have a look in Books Online for details of the inserted and deleted tables.
the inserted table will contain the ust inserted rows. It will have all teh columns of the base table/view.
INSERT into kontakt (nr, telefon, adress)
SELECT nr, telefon, adress FROM inserted
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply