in

Community Server

The platform that enables you to build rich, interactive communities

sql

junio 2009 - Posts

  • Tamaño de Tablas

    Con este script se puede conocer el tamaƱo de cada una de las tablas de una base de datos.

    CREATE PROCEDURE spTableSpace

    AS

    BEGIN

    DECLARE @tablename sysname

    DECLARE tables_cursor CURSOR FOR SELECT name FROM sysobjects

    WHERE type = 'U'

    ORDER BY name OPEN tables_cursor FETCH NEXT

    FROM tables_cursor INTO @tablename WHILE (@@FETCH_STATUS <> -1)

    BEGIN

    EXEC ('sp_spaceused ' + @tablename)

    FETCH NEXT FROM tables_cursor INTO @tablename

    END

    CLOSE tables_cursor DEALLOCATE tables_cursor

    END

    GO

    exec spTableSpace

    drop procedure spTableSpace

     

Powered by Community Server (Non-Commercial Edition), by Telligent Systems