I’m using the function sp_spaceused to get the details of all the tables in a DB. The index_size column is VARCHAR returned complete with ‘ KB’ on the end, however I want to to display in MB. All I need to know is how to strip out the KB, I can do the rest! 😀
UPDATE: I don’t feel this is a duplicate of the other question suggested as I was looking for a SQL only solution, which was given in this thread.
REPLACE(column, ‘KB’, ”). No need for LEN and other stuff
On SQL 2005, this will give you the ‘reserved’ value:
Some more investigation should allow you to read index vs data space out of the catlog views too