sqldba_icon (6/9/2011)
thanks..let me provide some more details..there is a table more than 100 gb in size with a column ntext which occupies 90% of total table space. Goal is to change data type to varchar and shrink the db..Any ideas?
An nText -> nVarchar conversion is not going to save you any space. It's a good idea to get away from the old LOB formats, as nVarchar(max) is much easier to work with, however.
nVARCHAR(MAX) will still act like LOB data, using independent data pages to store the overflow data. You will probably want to setup a separate filegroup for the LOB data, as it's less painful to administrate that way and you don't end up with as many fragmentation issues you do if you leave it in the primary filegroup. A second file on the same drive will still make your life easier here.
You still want to do the conversion, but not for space reasons.
Something you may want to do, because of the size, and if you have the room, is rebuild the table as a second table and swap them, so you don't have to lock the database up long term. You'd need auditing for something like that (even just store the IDs of new/updated/deleted records via trigger) while it builds, so that between the swaps you can refresh any rows that were modified between when you last read it and what it was just before you removed it from availability.