Drop, truncate rebuild constraints | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Drop, truncate rebuild constraints

When running an import for a very large table, not needed to be logged, I need to drop the constraints, truncate the table, rebuild the constraints. I dropped the constraints using sp_MSDropConstraint, truncate run fine, but when rebuilding the constraints I got just the ones directly related to the PK in that particular table, but not the FK’s from other tables. What I am doing wrong? Any suggestions? Any input will be appreaciated. Thank you
Generate the script for the constraints including the associate tables for primary & foreign key constraints. Run the DROP script and enable the DTS package to execute and run ADD script to add the constraints. Refer to books online for the topic Constraints –> Precendence for information. HTH Satya SKJ
Moderator
http://www.SQL-Server-Performance.Com/forum
This posting is provided “AS IS” with no rights for the sake of knowledge sharing.
]]>