script to find actual filled size of a row

  • I need a script to return the actual filled size of a row. I have a table with so many varchar columns that it would go over 8000 if all the varchar’s were full. Now the developers want to add 4 more varchar columns. I need to know how close we are to disaster.

  • Would the results to

    DBCC SHOWCONTIG ({table_name}) WITH TABLERESULTS

    Give me good numbers for this?

  • Can't you just add up the widths used and then return the maximum found? Something like:

    
    
    SELECT MAX(DATALENGTH(Col1)) + DATALENGTH(Col2) + ...)
    FROM TheTable

    You'll need to just add 16 instead of the DATALENGTH for any BLOBs, though.

    --Jonathan



    --Jonathan

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply