Please visit our sponsor
UNKNOWN --************************************** -- for :Spaces Used --************************************** Copyright : Jerome MAZET (France) jerome.mazet@usa.net --************************************** -- Name: Spaces Used -- Description:Space Used : This script gives you all the space used by each table -- By: Jerome MAZET -- -- -- Inputs:None -- -- Returns:Space used by data, indexes, space allocated, and free space for each table -- --Assumes:None -- --Side Effects:None --This code is copyrighted and has limited warranties. --Please see http://www.Planet-Source-Code.com/xq/ASP/txtCodeId.311/lngWId.5/qx/vb/scripts/ShowCode.htm --for details. --************************************** /*********************************************************************/ /* Procedure stockee: SpaceUsed */ /* Creation Date:20/06/2001 */ /* Copyright:Jerome MAZET*/ /* Written by:Jerome MAZET */ /* Contact: jerome.mazet@usa.net*/ /* Web Site: http://devinfo.multimania.com*/ /* Principe: Cette procedure retourne la place utilisee par chaque*/ /*table*/ /**/ /*********************************************************************/ 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