SQL Server Item Purge w/ Foreign Key Constraints
Posted on 2011-02-23
I would like to purge some items out of our sql table that has foreign key constraints associated with it. I have saved these specific items to a historical table. What is the best practice in deleting these items from this type of table with regard to the foreign keys? Do I have to drop and recreated the keys? If so, what is the proper way in doing so, so that I do not disturb the data I still want retained in the table.
delete from dimitem where
itemwk not in (select distinct(itemwk) from factcustsales)and datepart(year, effbegindate) <= '2008'