I use this for SQL Server, it does a reasonable job, it just won't match
those B attachment tables, but those are easily worked out, plus you'll
need to remove " KB" AND REPLACE WITH "" to sort on size. 

 

 

 

 

select 'Database Name: ', db_name()

 

set nocount on

 

if exists(select name from tempdb..sysobjects where name='##tmp')

 

drop table ##tmp

 

create table ##tmp(nam varchar(50), rows int, res varchar(15),data
varchar(15),ind_sze varchar(15),unsed varchar(15))

 

go

 

declare @tblname varchar(50)

 

declare tblname CURSOR for select name from sysobjects where xtype='U'

 

open tblname

 

Fetch next from tblname into @tblname

 

WHILE @@FETCH_STATUS = 0

 

BEGIN

 

insert into ##tmp

 

exec sp_spaceused @tblname

 

  FETCH NEXT FROM tblname INTO @tblname

 

END

 

CLOSE tblname

 

deallocate tblname

 

go

 

select nam Table_Name,rows Total_Rows,res Total_Table_Size,data
Data_size,ind_sze Index_Size,unsed Unused_Space,

ViewName = (select arschema.[name] from arschema where arschema.schemaid
= (

SELECT CASE ISNUMERIC(SUBSTRING(nam,2,DATALENGTH(nam)))

WHEN 1 THEN SUBSTRING(nam,2,DATALENGTH(nam))

ELSE 0

END)

) 

from ##tmp

 

drop table ##tmp

 

 

 

Regards,

 

Andrew C. Goodall

Software Engineer

Development Services

ago...@jcpenney.com

T 972.431.1518

F 972.431.1027

jcpenney

6501 Legacy Drive

Plano, TX 75024

jcp.com

 

From: Action Request System discussion list(ARSList)
[mailto:arslist@arslist.org] On Behalf Of Benz, Michael
Sent: Sunday, July 22, 2012 7:54 PM
To: arslist@arslist.org
Subject: Database Names

 

** 

Hello World

 

Our remedy database is growing a lot faster then we'd like. So we ran a
report that show us our largest tables. The bad side is, is that remedy
did not name them very nicely at all! Is there any easy way so find out
what table is what form?

 

EG: dbo.B2109C1000000351 is 14 GIG and we want to find out why

 

Thank you!

 

Regards,

 

Michael Benz

Remedy Developer

_attend WWRUG12 www.wwrug.com ARSlist: "Where the Answers Are"_ 

<font face="monospace"size="-3"><br>The information transmitted is intended 
only for the person or entity to which it is addressed and <br>may contain 
confidential and/or privileged material. If the reader of this message is not 
the intended<br>recipient, you are hereby notified that your access is 
unauthorized, and any review, dissemination,<br>distribution or copying of this 
message including any attachments is strictly prohibited. If you are not<br>the 
intended recipient, please contact the sender and delete the material from any 
computer.<br>

_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
attend wwrug12 www.wwrug12.com ARSList: "Where the Answers Are"

Reply via email to