Archive for August, 2008|Monthly archive page

Blender – Open Source 3D Content Creation Suite

Blender is the free open source 3D content creation suite, available for all major operating systems under the GNU General Public License.

Blender can:

model • shade • animate • render • composite • interactive 3d

Read more »

Query to Count Table Rows and Columns on a Database

Here is a nice query to count number of columns and rows on a table:

USE DatabaseName
GO
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_namea.row_counta.data_size
    ORDER BY   CAST(REPLACE(a.data_size' KB'''AS integerDESC
DROP TABLE #temp

Just change Databasename to the target database and #temp to the preferred temporary table

Thanks to SQLAuthority