title: Cascading update using update trigger in sql server
body: <p>I'm using following code to update foreign key value in <code>Residence</code> table on update of <code>ProvinceID</code>, but I get this error:</p>
  
  <blockquote>
    <p>update statement conflicted with reference constraint "FK_Residence_Province". The conflict occurred in database '', table "dbo,Residences", column "ResidenceState".</p>
  </blockquote>
  
  <p>Code:</p>
  
  <pre><code>CREATE trigger [dbo].[UPOnProvinceDelete] 
  ON [seniors].[dbo].[Provinces] 
  FOR UPDATE AS
      SET NOCOUNT ON
  
      IF UPDATE([ProvinceID])
      BEGIN
         UPDATE seniors.dbo.Residences
         SET [Residences].[ResidenceState] = inserted.[ProvinceID]
         FROM [Residences], deleted, inserted
         WHERE deleted.[ProvinceID]= [Residences].[ResidenceState]
           AND deleted.[ProvinceID]= inserted.[ProvinceID]
      END;
  </code></pre>