# Delete a Person ;
# This script describes how to delete persons  from the CTFS/ForestGeo database
# Shameema Esufali June 16 2020

SET @YourPersonnelID=1;  
# This would be the personnel id of the system admin or programmer 
# who is making these changes.
 
SET @firstname="Alla", @lastname="Gracie";

# 1. Remove the record linking the person with the role. *****************************
SELECT @deletepersonid:=PersonnelID 
 FROM Personnel 
 WHERE FirstName =@firstname AND LastName =@lastname;
 
DELETE FROM PersonnelRole WHERE PersonnelID= @deletepersonid; 

# 2. Delete the persons record *******************************************************

DELETE FROM Personnel 
 WHERE FirstName =@firstname AND LastName =@lastname;

# Note the where clause for the operation matches the where clause for 
# selecting the records to log.
# ************************************************************************************
           
