Sunday, March 25, 2012

database size comparisons

hI
I have to database with more than 500 tables. Is there any way to find
number of rows in each tables from system tables. I want this result to
compare another database in different server.
Going table by table is practically time consuming process.
Can any one help me
Thanks
KalyanTry this:
select object_name(id) as TableName, rows
from sysindexes
where indid in (0, 1)
Adam Machanic
SQL Server MVP
http://www.sqljunkies.com/weblog/amachanic
--
"Kalyan" <Kalyan@.discussions.microsoft.com> wrote in message
news:01CB0D73-2553-4531-B7B5-ACAD5C186466@.microsoft.com...
> hI
> I have to database with more than 500 tables. Is there any way to find
> number of rows in each tables from system tables. I want this result to
> compare another database in different server.
> Going table by table is practically time consuming process.
> Can any one help me
> Thanks
> Kalyan|||To add to Adam's response, the row column in sysindexes can be used as an
estimated row count but won't necessarily be accurate. You can use DBCC
UPDATEUSAGE beforehand to get a more accurate row count. The only way to
get a reliable accurate count is with SELECT COUNT(*).
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Kalyan" <Kalyan@.discussions.microsoft.com> wrote in message
news:01CB0D73-2553-4531-B7B5-ACAD5C186466@.microsoft.com...
> hI
> I have to database with more than 500 tables. Is there any way to find
> number of rows in each tables from system tables. I want this result to
> compare another database in different server.
> Going table by table is practically time consuming process.
> Can any one help me
> Thanks
> Kalyan|||This is a multi-part message in MIME format.
--=_NextPart_000_0096_01C4DCAE.8E68F580
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: quoted-printable
Try this:
exec sp_msforeachtable "sp_spaceused '?' "
Tunji O
"Kalyan" <Kalyan@.discussions.microsoft.com> wrote in message =news:01CB0D73-2553-4531-B7B5-ACAD5C186466@.microsoft.com...
hI
I have to database with more than 500 tables. Is there any way to find =
number of rows in each tables from system tables. I want this result =to compare another database in different server.
Going table by table is practically time consuming process.
Can any one help me
Thanks
Kalyan
--=_NextPart_000_0096_01C4DCAE.8E68F580
Content-Type: text/html;
charset="Utf-8"
Content-Transfer-Encoding: quoted-printable
=EF=BB=BF<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
&

Try this:
exec sp_msforeachtable "sp_spaceused ='?' "
Tunji O
"Kalyan" wrote in message news:01C=B0D73-2553-4531-B7B5-ACAD5C186466@.microsoft.com...hII have to database with more than 500 tables. Is there any way to find number of rows in each tables from system tables. I want this =result to compare another database in different server.Going table =by table is practically time consuming process.Can any one help meThanksKalyan

--=_NextPart_000_0096_01C4DCAE.8E68F580--

No comments:

Post a Comment