title: trigger at particular column with condition
body: <p>I want to check a Column value when update.If its match insert into another table.
  My Tables:<img src="https://i.stack.imgur.com/KcmoC.png" alt="FirstTable"></p>
  
  <p><img src="https://i.stack.imgur.com/1Wxcu.png" alt="SecondTable"></p>
  
  <p>My trigger:<br></p>
  
  <pre><code>CREATE TRIGGER tr_test
  ON test1
  FOR UPDATE
  AS
      SET nocount ON
  
      IF ( Update(sname) )
        DECLARE @Name NVARCHAR
  
      DECLARE @id INT
  
      SET @id=@@IDENTITY 
      SET @Name=(SELECT sname
                 FROM   test1
                 WHERE  id = @id)
  
      IF( @Name = 'Paras' )
        BEGIN
            INSERT INTO test2
                        (loginfo)
            VALUES     ('success')
        END  
  </code></pre>
  
  <p>And my update query is:</p>
  
  <pre><code>update Test1 set Sname='Paras' where ID=1
  </code></pre>
  
  <p>When I run this update query Nothing is happen.<code>Test2</code> table is empty.I think problem is  <code>@@IDENTITY</code> but not sure.Thanks.</p>