longmatch
Programmer
- Nov 1, 2001
- 406
I have two tables in my sql server database, table1 and table2. There is a trigger in table1 for insert. When records are inserted into table1, the new inserted data will be inserted into table2. When a new record is inserted into table1, I found two records in table2 (two copies). It looks like the insert operation is done twice. not sure why? not sure how to avoid it either.
My trigger is:
CREATE TRIGGER [copyInserted] ON [Table1]
FOR INSERT
INSERT INTO [table2]
SELECT NAME, AGE
FROM INSERTED
thanks
longmatch
My trigger is:
CREATE TRIGGER [copyInserted] ON [Table1]
FOR INSERT
INSERT INTO [table2]
SELECT NAME, AGE
FROM INSERTED
thanks
longmatch