SQL Server Query Archive
maandag, november 27, 2006
vrijdag, november 24, 2006
Space used - 2000
-- DBCC UPDATEUSAGE (0) WITH NO_INFOMSGS;
declare AllTables cursor fast_forward for
select name from sysobjects where type='u'
open AllTables
declare @TableName varchar(255)
create table #SpaceUsed
(
TableName varchar(255),
NbrRows varchar(255),
Reserved varchar(255),
Data varchar(255),
Index_Size varchar(255),
[Free] varchar(255)
)
fetch from AllTables into @TableName
while @@FETCH_STATUS=0
begin
insert into #SpaceUsed
exec sp_spaceused @TableName
fetch next from AllTables into @TableName
end
close AllTables
deallocate AllTables
select * from #SpaceUsed order by TableName
drop table #SpaceUsed