Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- OrtizOL - xCSw - http://ortizol.blogspot.com
- -- Declaración de variables:
- DECLARE @TablasAdventureWorks TABLE (SchemaTable varchar(100));
- DECLARE @NombreTabla varchar(100);
- -- Inserta los nombres de las tablas en la tabla @ATablasAdventureWorks:
- INSERT @TablasAdventureWorks (SchemaTable)
- SELECT TABLE_SCHEMA + '.' + TABLE_NAME
- FROM INFORMATION_SCHEMA.tables
- WHERE TABLE_TYPE = 'BASE TABLE'
- ORDER BY TABLE_SCHEMA + '.' + TABLE_NAME;
- -- Reporte de espacio usado por cada table con el
- -- el procedimiento almacenado `sp_spaceused`:
- WHILE (SELECT COUNT(*) FROM @TablasAdventureWorks) > 0
- BEGIN
- SELECT TOP 1 @NombreTabla = SchemaTable
- FROM @TablasAdventureWorks
- ORDER BY SchemaTable;
- EXEC sp_spaceused @NombreTabla;
- DELETE @TablasAdventureWorks
- WHERE SchemaTable = @NombreTabla;
- END;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement