TRUNCATE TABLE is a very quick way to delete all rows in a table. However,TRUNCATE TABLE is not permitted when there are FK referring to the table,and for a very good reason: TRUNCATE TABLE is fast because it does notlook at the data in the table, it just deallocates all pages allocated to thetable.But there is one special case that TRUNCATE TABLE ought to consider: allreferring tables are empty. That would permit you to run TRUNCATE TABLEon a set of tables as long as you truncate them in the right order. Examiningwhether a table is empty or not is a quick operations in most cases. This suggestion is similar tohttps://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=251876but with my suggestion you would not have to fiddle with enabling/disabling constraints. On other hand, the suggestion in 251876 covers the situation when you want to truncate a single table and reload it.
Category
Proposed Solution
Benefits
Other Benefits