In this post I’ll explain how to empty large table. One of our customers had a table with 450GB of size. And we tried all ways to empty this table, but no one has solved the problem.
We tried to truncate the table, but truncate operation took more than 10 hours and didn’t solve the problem. And when we used WHERE statement in any query on this table, SQL server executes the query without stopping.
The only way that I could to empty the table in 1 second was as the following:
set rowcount 1;
truncate table TABLE_NAME;
And of course after truncating the table, just go and shrink the database.
1 comment:
yes ,you are right and by this approach you just remove the pointer to this table and data rows of table will be removed by shrink
Post a Comment