title: Call Stored Procedure within Create Trigger in SQL Server
body: <p>I have a stored procedure named insert2Newsletter with parameters </p>
  
  <pre><code>(@sex nvarchar(10),
  @f_name nvarchar(50),
  @l_name nvarchar(70),
  @email nvarchar(75),
  @ip_address nvarchar(50),
  @hotelID int,
  @maArt nchar(2))
  </code></pre>
  
  <p>I want call this stored procedure in an insert trigger. How do I retrieve the corresponding fields from inserted and how do i call insert2Newsletter within the trigger?</p>
  
  <p>I tried without success:</p>
  
  <pre><code>SET ANSI_NULLS ON
  GO
  SET QUOTED_IDENTIFIER ON
  GO
  CREATE TRIGGER RA2Newsletter 
     ON  [dbo].[Reiseagent] 
     AFTER INSERT
  AS 
  DECLARE @rAgent_Name nvarchar(50),
  DECLARE @rAgent_Email nvarchar(50),
  DECLARE @rAgent_IP nvarchar(50),
  DECLARE @hotelID int
  
  BEGIN
      SET NOCOUNT ON;
  
      -- Insert statements for trigger here
      Select @rAgent_Name=rAgent_Name, @rAgent_Email=rAgent_Email, @rAgent_IP=rAgent_IP, @hotelID=hotelID  From Inserted
      EXEC insert2Newsletter '','',@rAgent_Name,@rAgent_Email,rAgent_IP,@hotelID,'RA' 
  
  
  END
  GO
  </code></pre>
  
  <p>thx a lot for your feedback... greetings...</p>