Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save arjunKumbakkara/eb4219abfb3e946979017b3a31b63cd1 to your computer and use it in GitHub Desktop.
Save arjunKumbakkara/eb4219abfb3e946979017b3a31b63cd1 to your computer and use it in GitHub Desktop.
Truncate a table with Foreign Key Constraints (If the SET FOREIGN KEY =0 doesnt work then)
Classic method: Turn off the Foreign Keys and
#SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS;
#SET FOREIGN_KEY_CHECKS=0;
DO YOUR CHANGES!!
#SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
If Not:
Alternative:
SET SQL_SAFE_UPDATES = 0;
DELETE FROM WFM_SkillLevelDesignationMapper;
ALTER TABLE WFM_SkillLevelDesignationMapper AUTO_INCREMENT = 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment