Whenever there is an issue related to "SQL Integrity constraint", I have tried doing the below and this has worked for me very well:
Each time, you plan to update products using Magento Admin Panel or Another source in Magento.
Magento Enterprise Edition
Navigate to System > Configuration > Advanced > Index Management > Index Options > Set all the options to "Update when scheduled"
Magento Community Edition
Navigate to System > Index Management > Select all > Actions > Change Index Mode > Manual Update > Save
These settings are to avoid any SQL Integrity Constraint errors during Bulk/Single Product Updates.
After products are updated, revert the changes back as below:
Magento Enterprise Edition
Navigate to System > Configuration > Advanced > Index Management > Index Options > Set all the options to "Update on Save" > Save
Magento Community Edition
Navigate to System > Index Management > Select all > Actions > Change Index Mode > Update on Save > Save
Note :: Make sure the /var/locks is removed before setting these and before doing a bulk product update.
Let me know if this helps.
Happy Coding...