Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

why are my records copied twice"

Status
Not open for further replies.

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
 
see whether you have trigger on table2 which inserts value into table1
 
I am using SQL Server 7.0 right now. Do you know how to see the trigger I created in for a table? How to know what happened after trigger is fired? I have just started to use SQL server instead of MS Access.

thanks

longmatch
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top