Question

I've tried to find out the answer to this question, but i haven't found a clear and/or precise answer.

In MS SQL (2008 in this case) does any of this commands: Delete, Truncate or Drop (table), "automatically" sets free the amount of disk space that was used to be occupied with the data?

I've my idea, but is based on a bunch of comments... nothing really straight.

I had read some comments about shrink (goods, and bads), so my intention is avoid using this command, and that's why I ask.

Thanks in advance and please, excuse my use of english... (the main use that I give, is programming and SQL! )

Was it helpful?

Solution

None of those commands free disk space. The files in the filegroup stay as they were in all three cases. The allocation to the HoBT (Heap or B-Tree) is cleared on truncate or drop. Deletes just wipe the rows from the tables pages, but the pages stay allocated to the HoBT. The data files stay the same size unless you shrink them, which is generally not a good idea.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top