Ok... looks like the insert new member fires off the trigger just fine. Both tables are updated correctly.
However, when a user tries to update their profile... They recieve an sql error stating a primary key violation.
Here is the exact trigger that causes that error.
==============
CREATE trigger [TR_Players(,I,U,)]
on dbo.[players]
for insert,update
as begin
insert [Forum].dbo.[FORUM_MEMBERS] (M_name, M_username, M_password, M_email, M_quote)
select [PEmail], [PEmail], [Ppassword], [PEmail], [pcomments]
from inserted
end
=============
Now I went ahead and edited the trigger to be this,
=============
CREATE trigger [TR_Players(,I,)]
on dbo.[players]
for Insert
as begin
Insert [Forum].dbo.[FORUM_MEMBERS] (M_name, M_username, M_password, M_email, M_quote)
select [PEmail], [PEmail], [Ppassword], [PEmail], [pcomments]
from inserted
end
=============
As you might expect... this fires off correctly and both tables get their new information.
Now the question is how do I get the update trigger to update table 2 (FORUM_MEMBERS) without attempting to add another row with the same information, thus violating the pk constraint.
I tried to add a second trigger to the same table just for updates like such.
=============
CREATE trigger [TR_Players(,U,)]
on dbo.[players]
for Update
as begin
Insert [Forum].dbo.[FORUM_MEMBERS] (M_name, M_username, M_password, M_email, M_quote)
select [PEmail], [PEmail], [Ppassword], [PEmail], [pcomments]
from inserted
end
=============
Too bad that gave me the exact same error. Also, syntax wise... im kind of confused why I had to use "inserted" and not "updated" to get successful syntax checking??? Does the temp table updated not exist with triggers? Can I not run two seperate triggers against the same table?
Oh and as an FYI. I did not want delete syntax... I was just commenting that in your post i saw the keyword delete?
Like always.... thanks very much for your time to deal with my issues..