jayrocks20 (10/2/2014)
I have a selfreferenced foreignkey table . Deleting records from this table is complicated.I am using a CTE to fetch all child records to be deleted together to avoid foreign key constraint error however it has performance issues and locks the table for long.
as an alterative I though of :
ALTER TABLE
NOCHECK CONSTRAINT FK_XXX
DELETE FROM TABLE WHERE XXX
ALTER TABLE CHECK CONSTRAINT FK_XXX
I want to know the Risks/ drawbacks involved in using this ALTER TABLE NO CHECK CONSTRAINT on production servers.
Thanks..
Why are you posting your new question as a reply on a 7 year old thread? You can create a new question using the "Add Topic" button once you entered the correct sub-forum ("Administration - SQL Server 2014", "SQL 2012 - General" or whatever is appropriate for your question).