Experts Exchange connects you with the people and services you need so you can get back to work.
USE BizTalkDTADb --You can change this to desires database
SET NOCOUNT ON
-- DB size.
-- Table row counts and sizes.
CREATE TABLE #t
, [rows] CHAR(11)
, reserved VARCHAR(18)
, data VARCHAR(18)
, index_size VARCHAR(18)
, unused VARCHAR(18)
INSERT #t EXEC sp_msForEachTable 'EXEC sp_spaceused ''?'''
SELECT [name] as 'Table name'
, [rows] as 'Rows'
, cast(replace(reserved, ' KB', '') as bigint) as 'reserved (KB)'
, cast(replace(data, ' KB', '') as bigint) as 'data (KB)'
, cast(replace(index_size, ' KB', '') as bigint) as 'index_size (KB)'
, cast(replace(unused, ' KB', '') as bigint) as 'unused (KB)'
-- # of rows.
SELECT SUM(CAST([rows] AS int)) AS [rows]
DROP TABLE #t
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.