• This cursorless loop was a new trick for me, and very appreciated. 


    WHILE @TableName IS NOT NULL

    BEGIN

    SELECT @TableName=MIN(TableName)

    FROM @UserTables

    WHERE TableName>@TableName

    IF @TableName IS NOT NULL

    BEGIN

    INSERT INTO #T

    exec sp_dba_spaceused @TableName

    END

    END