Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_spaceused

 

This is a procedure in the mssqlsystemresource database. If you want to run this procedure for all tables in the current database you can use the following script in SQL2000, SQL2005 and SQL2008.

declare @name sysname
declare @owner sysname
declare @Qry nvarchar(500)

declare cObjects cursor READ_ONLY
for
select sysobjects.name, sysusers.name from sysobjects INNER JOIN sysusers ON sysobjects.uid = sysusers.uid where type='U'

open cObjects

fetch cObjects into @name, @owner
while @@fetch_status=0
begin
  set @Qry = 'EXEC sp_spaceused ''' + @owner + '.' + @name + ''''
  print @Qry
  exec sp_executesql @Qry
  fetch cObjects into @name, @owner
end

close cObjects
deallocate cObjects




Syntax

This is a procedure in the mssqlsystemresource database. If you want to run this procedure for all tables in the current database you can use the following script in SQL2000, SQL2005 and SQL2008.

declare @name sysname
declare @owner sysname
declare @Qry nvarchar(500)

declare cObjects cursor READ_ONLY
for
select sysobjects.name, sysusers.name from sysobjects INNER JOIN sysusers ON sysobjects.uid = sysusers.uid where type='U'

open cObjects

fetch cObjects into @name, @owner
while @@fetch_status=0
begin
  set @Qry = 'EXEC sp_spaceused ''' + @owner + '.' + @name + ''''
  print @Qry
  exec sp_executesql @Qry
  fetch cObjects into @name, @owner
end

close cObjects
deallocate cObjects

 
Last revision
News

  Query a named instance
Sybase+ASE+silent+install
SQL 2008 R2
Deprecated procedures in SQL2008
Reporting Services item-level role definitions
Create all your missing indexes
Converting datetime field
Start MSSQL Server Profiler at time
Replicating MSSQL Server views
Exploring Microsoft Sharepoint
The OLE DB provider "SQLNCLI10" for linked server indicates.
Mobile solar charger
Oracle to SQL Server replication
Cannot insert the value NULL into column
Undocumented Microsoft SQL Server 2008
VMware
Zoekmachine optimalisatie
SQL Servers hidden objects
FckEditor
Flash in Ajax
De hype die AJAX heet
Barcode scannen
MySQL; Gratis, makkelijk en snel!
PHP
sIFR; de combinatie tussen HTML en Flash