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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert text in another table by using a Trigger.

Status
Not open for further replies.
Sep 27, 2001
179
AU
I'm trying to create a trigger that will change part of a text field.

So, because I can't use text fields from the Inserted table the plan was to copy the inserted fields to a table using a join.

So I have the following code, but it won't update the text field, but does update the id field. Any idea?

Thanks
Code:
CREATE TRIGGER TRG_UpdateMailboxTemp ON [dbo].[MAILBOX] 
for INSERT
as
BEGIN
--Delete the rows from the table, should only have 1 row
truncate table mailboxupdate
--Copy the details of the email to a temporary holding table
insert into mailboxupdate
Select  recid, rfc822 
from inserted i
join mailbox m on i.recid = m.recid
END
 
try sepcifying which table teh field belongs to
(I'm suprised that didn;t give you an ambiguous field error onthe id field)

Select i.recid, m.rfc822
from inserted i
join mailbox m on i.recid = m.recid


Questions about posting. See faq183-874
Click here to help with Hurricane Relief
 
Hi

I tried specifying the tables but still does not work.

Any help would be terrific

Thanks

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top