Può essere comodo avere un riferimento delle dimensioni delle tabelle di un database
richiamando questa store procedure si ottiene in tempo reale lo stato delle tabelle.
come si puo notare nell’immagine allegata formisce in maniera dettagliata i dati necessari.
CREATE PROCEDURE [dbo].[CalculateTableSize] AS BEGIN SET NOCOUNT ON; CREATE TABLE #FrameworkTableSize( [TableName] [varchar](100) NULL, [RowNumber] [int] NULL, [KBReservedSize] varchar(100) NULL, [KBDataSize] varchar(100) NULL, [KBIndexSize] varchar(100) NULL, [KBUnusedSize] varchar(100) NULL ) declare DBObjectCursor cursor for select 'dbo.' + name from dbo.sysobjects where xtype = 'u' declare @TableName varchar(100) open DBObjectCursor fetch next from DBObjectCursor into @TableName while @@fetch_status = 0 begin insert into #FrameworkTableSize (TableName, RowNumber , KBReservedSize, KBDataSize, KBIndexSize , KBUnusedSize) exec sp_spaceused @TableName fetch next from DBObjectCursor into @TableName end close DBObjectCursor deallocate DBObjectCursor SELECT * FROM #FrameworkTableSize END

About Diego Mancinelli
Da sempre appassionato di informatica e tutto ciò che riaguarda l' Information Tecnology. Mi occupo di progettazione, analisi e sviluppo di software e applicazioni web per piattaforme Windows, Android, iOS