title: Firing trigger for bulk insert
body: <pre><code>ALTER TRIGGER [dbo].[TR_O_SALESMAN_INS]
     ON  [dbo].[O_SALESMAN]
     AFTER INSERT
  AS 
  BEGIN
      -- SET NOCOUNT ON added to prevent extra result sets from
      -- interfering with SELECT statements.
      SET NOCOUNT ON;
  
      -- Insert statements for trigger here
      DECLARE @SLSMAN_CD NVARCHAR(20)
      DECLARE @SLSMAN_NAME NVARCHAR(20)
      SELECT @SLSMAN_CD = SLSMAN_CD,@SLSMAN_NAME=SLSMAN_NAME
      FROM INSERTED
  
      IF NOT EXISTS(SELECT * FROM O_SALESMAN_USER WHERE SLSMAN_CD = @SLSMAN_CD)
      BEGIN
          INSERT INTO O_SALESMAN_USER(SLSMAN_CD, PASSWORD, USER_CD)
          VALUES(@SLSMAN_CD, @SLSMAN_CD,@SLSMAN_NAME )
      END
  END
  </code></pre>
  
  <p>This is the trigger written for a <code>table(O_SALESMAN)</code> to fetch few columns from it and insert it into one another <code>table(O_SALESMAN_USER)</code>. Presently bulk data is getting inserted into <code>O_SALESMAN</code> table through a stored procedure, where as the trigger is getting fired only once and <code>O_SALESMAN_USER</code> is having only one record inserted each time whenever the stored procedure is being executed,i want trigger to run after each and every record that gets inserted into <code>O_SALESMAN</code> such that both tables should have same count which is not happening..so please let me know what can be modified in this Trigger to achieve the same....</p>