Tuesday, March 27, 2012

DB and tables information

Hi there!
Using SQL Enterprise Manager I can see some information
about DB usage and tables and indexes (right click over
DB name and View option)
How ca I print or export this information? Is there any
store procedure(s) to get this information?
Thanks!
LJLJ,
SQL Profiler is great for determining the queries used by an application.
Here's the code that EM uses to populate the tables/indexes Taskpad view:
select
sysusers.name + N'.' + sysobjects.name as ObjectName,
sysindexes.name as IndexName,
sysindexes.rows,
case indid
when 1 then 1
else 0
end as IsClusteredIndex,
sysindexes.indid,
sysobjects.name,
sysusers.name
from
sysusers, sysobjects, sysindexes
where
sysusers.uid = sysobjects.uid
and
sysindexes.id = sysobjects.id
and
sysobjects.name not like '#%'
and
OBJECTPROPERTY(sysobjects.id, N'IsMSShipped') <> 1
and
OBJECTPROPERTY(sysobjects.id, N'IsSystemTable') = 0
order by
ObjectName,
IsClusteredIndex DESC,
indexproperty(sysindexes.id, sysindexes.name, N'IsStatistics'),
IndexName
Dan Farino
Sr. Systems Engineer
Stamps.com, Inc.
news.danATstamps.com
"LJ" <leyla.garcia@.unisabana.edu.co> wrote in message
news:00f801c3424b$0f0a4ea0$a301280a@.phx.gbl...
> Hi there!
> Using SQL Enterprise Manager I can see some information
> about DB usage and tables and indexes (right click over
> DB name and View option)
> How ca I print or export this information? Is there any
> store procedure(s) to get this information?
> Thanks!
> LJ

No comments:

Post a Comment