I am trying to create a trigger that will email the results of a record that was submitted through asp website into sql server database (2005).
Would like the trigger to fire an email after a new record is submitted.
Would like the email itself to be a summary or the entire record.
The Table View name is requestMaster.
The Database Name is Food.
Do I need to list off all the fields in the Table?
I am receiving this error when I execute.
Msg 102, Level 15, State 1, Procedure AlertRequest, Line 11
Incorrect syntax near '@squery'.
Msg 137, Level 15, State 2, Procedure AlertRequest, Line 16
Must declare the scalar variable "@squery".
CREATE TRIGGER Food.AlertRequest
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for trigger here
@squery = SELECT * from RequestMaster
@profile_name = DBMail,
@recipients = 'email@example.com',
@query = @squery,
@subject = @message,
@attach_query_result_as_file = 1 ;