Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How big are the Tables in my Database
Message
 
 
To
17/04/2008 12:49:36
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01311489
Message ID:
01314839
Views:
8
>I am a FoxPro developer but sometimes my boss asks me to do work on other database systems. I have been asked to give a report of the file size of each table in a particular database. The database is one in our SQL Server. I have never done this even for FfoxPro. Is it possible without haveing to physically look at the properties of each(100+) tables? Can I use sql from FoxPro to get this report?

Here you're :
CREATE TABLE #temp (
                table_name sysname ,
                row_count INT,
                reserved_size VARCHAR(50),
                data_size VARCHAR(50),
                index_size VARCHAR(50),
                unused_size VARCHAR(50))
    SET NOCOUNT ON
INSERT     #temp
    EXEC       sp_msforeachtable 'sp_spaceused ''?'''
SELECT     a.table_name,
            a.row_count,
            COUNT(*) AS col_count,
            a.data_size
    FROM       #temp a
            INNER JOIN information_schema.columns b
            ON a.table_name collate database_default
    = b.table_name collate database_default
    GROUP BY   a.table_name, a.row_count, a.data_size
    ORDER BY   CAST(REPLACE(a.data_size, ' KB', '') AS integer) DESC
DROP TABLE #temp
from http://blog.sqlauthority.com/2007/01/10/sql-server-query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database-find-biggest-table-in-database/
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform