I need to find out how much disk space a single row is taking up in a table. I can then use this as an approximate to work out how much disk space I can recover by removing old unneeded data. Would I have to combine all of the columns in a single
SELECT statement, like so?
SELECT DATALENGTH([Id]) + DATALENGTH([Column1]) + DATALENGTH([Column2]) AS 'Size' FROM [MyTable]
Or is there a better, more efficient way that I'm not aware of?
I have just noticed that if a column has a
NULL value, then I get
NULL as the result.