高手来看看啊(导出所有表的大小).
现在已经能得到所有表的大小了,但不知道怎样去导出?
declare @name varchar(100)
DECLARE cur CURSOR FOR
SELECT
sysobjects.name
FROM sysobjects with(nolock)
WHERE sysobjects.xtype = 'u' and sysobjects.status >= 0
ORDER By sysobjects.name ASC
open cur
fetch next from cur into @name
while @@fetch_status = 0
begin
exec sp_spaceused @name
fetch next from cur into @name
end
close cur
deallocate cur
Go