Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 error referencing 'inserted' table in trigger

Author  Topic 

kaus
Posting Yak Master

179 Posts

Posted - 2001-05-30 : 12:30:53
I have sp that inserts data from asp page and a trigger that fires email to inform us of the insert. I'm getting an 'invalid object name' for the inserted table when I try to reference it in the trigger. Am I not correctly using 'inserted' ?? Below is trigger and sp

Trigger
CREATE TRIGGER mail_data_request ON Requests
FOR INSERT
AS
exec master.dbo.xp_sendmail 'pvitt@sawpa.org', @query = 'DataRequests.dbo.sp_data_request_query',
@subject = 'new data request'

Query Stored Proc
CREATE PROCEDURE [sp_data_request_query]
AS
select ins.FirstName + ' ' + ins.LastName + ', ' + ins.title + ' of ' +
ins.Organization as Requestor, ins.request_info as Requests, ins.email as email,
ins.ph_area_code + '-' + ins.ph_prefix + '-' + ins.ph_suffix as phone
from inserted ins

Thanks a lot


   

- Advertisement -