title: Deleting parent and child records
body: <p>I am trying to delete parent and child records from the db using the following stored procedure:</p>
  
  <pre><code>CREATE PROCEDURE [dbo].[DeleteCompanyPersonAndPhoneNumbers] (
      @personId int,
      @deleted bit output)
  AS
  BEGIN
      SET NOCOUNT ON;
      SET XACT_ABORT ON;
  
      set @deleted = 0
  
      begin transaction
  
          -- delete the phone numbers
          delete from PersonalPhoneNumber 
              where PersonalPhoneNumber.PersonId = @personId
  
          delete from ProfessionalProfile
              where ProfessionalProfile.Person_Id = @personId  
  
          delete from aspnet_UserProfile
              where aspnet_UserProfile.Person_ID = @personId
  
          delete from Accreditation
              where Accreditation.Person_ID = @personId
  
          delete from Qualification
                  where Qualification.Person_ID = @personId
  
          delete from PERSON where Person_ID = @personId
  
          set @deleted = 1
  
      commit transaction
  
  END
  </code></pre>
  
  <p>I have set the foreign key enforce off. When run the sp it only delete the parent record.</p>
  
  <p>I am doing anything wrong in the SP?</p>
  
  <p>Thanks</p>