Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 Reclaim space after setting column to NULL
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Yak Posting Veteran

79 Posts

Posted - 03/01/2013 :  11:35:54  Show Profile  Reply with Quote
I have a table with a varchar column that stores XML and consumes too much space..Hence I want to Set All XML fields to NULL and put those XMLs in another TAble. I dont want to drop the entire column since only 40 percent of the rows have XML while other have some other text stored in it.My problem Is when I set the XML fields to NULL the space occupied by the table does not change at all. I have tried DBCC CLEANTABLE but tat dint help..Also I dont want to copy the table into another table and rename it since the table is tooo heavy ..
Any Idea??

Edited by - Kimi86 on 03/01/2013 11:43:13

James K
Flowing Fount of Yak Knowledge

3873 Posts

Posted - 03/01/2013 :  12:14:38  Show Profile  Reply with Quote
The documentation seems to indicate that CLEANTABLE will reclaim space only for dropped columns:

You might want to try sp_spaceused with updateusage = 'TRUE'

I don't have any personal experience with either of these, so I have no constructive comments to add.
Go to Top of Page

Flowing Fount of Yak Knowledge

4614 Posts

Posted - 03/01/2013 :  13:10:42  Show Profile  Reply with Quote
I assume you mean that the MDF file didn't shrink? If so, SQL is not going to give up any space willingly. If you want to reclaim that disk space you'll have to shrink the database (if do decide to shrink your DB, read up on how to do it properly). You might try rebuilding the indexes and see if that helps.

Also after running CLEANTABLE did you run UPDATEUSAGE?
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000