create table tablesize (name varchar(50),rows int,reserved varchar(50), data varchar(50),index_size varchar(50),unused varchar(50)) insert into tablesize (name,rows,reserved, data,index_size,unused) exec sp_msforeachTable @Command1="sp_spaceused '?'" update tablesize set data=replace(data,'KB','') select *,convert(int,data) as a from tablesize order by A desc drop table tablesize DELETE FROM LocalCopyOf_vw_PoitemValues EXEC SP_SPACEUSED SELECT * FROM [Master].[dbo].[SYSPROCESSES] WHERE [DBID] IN ( SELECT [DBID] FROM [Master].[dbo].[SYSDATABASES] WHERE NAME='Ligentix4_1' )