In a script I would like to have the approximate number
of rows of a table.
Is there an easy way to get the 'approximate' number
of rows in a table without using count(*).
ben brugmanHi,
Use the below query,
select object_name(Id) as table_name,rows from sysindexes where indid=0
Thanks
Hari
MCDBA
"ben brugman" <ben@.niethier.nl> wrote in message
news:#0zv5NkuDHA.1888@.TK2MSFTNGP10.phx.gbl...
> In a script I would like to have the approximate number
> of rows of a table.
> Is there an easy way to get the 'approximate' number
> of rows in a table without using count(*).
> ben brugman
>|||Hari
Why just no use
sp_spaceused 'table'
"Hari" <hari_prasad_k@.hotmail.com> wrote in message
news:OUBPZWkuDHA.2432@.TK2MSFTNGP10.phx.gbl...
> Hi,
> Use the below query,
> select object_name(Id) as table_name,rows from sysindexes where indid=0
> Thanks
> Hari
> MCDBA
> "ben brugman" <ben@.niethier.nl> wrote in message
> news:#0zv5NkuDHA.1888@.TK2MSFTNGP10.phx.gbl...
> > In a script I would like to have the approximate number
> > of rows of a table.
> >
> > Is there an easy way to get the 'approximate' number
> > of rows in a table without using count(*).
> >
> > ben brugman
> >
> >
>|||approx=not accurate if stat is not uptodate.
select rows
from sysindexes
where id=object_id('your table name')
and indid<2
--
-oj
RAC v2.2 & QALite!
http://www.rac4sql.net
"ben brugman" <ben@.niethier.nl> wrote in message
news:%230zv5NkuDHA.1888@.TK2MSFTNGP10.phx.gbl...
> In a script I would like to have the approximate number
> of rows of a table.
> Is there an easy way to get the 'approximate' number
> of rows in a table without using count(*).
> ben brugman
>|||Thanks, Hari, Uri, Oj
this is exactly what I have been looking for.
(I did look at the sysindexes and sysobjects yesterday, but
missed the rows entry in the sysindexes table. Why, I do not know).
(Space_used uses the same numbers but it is more difficult to get
space_used results in a table).
Thanks again,
ben brugman
"ben brugman" <ben@.niethier.nl> wrote in message
news:#0zv5NkuDHA.1888@.TK2MSFTNGP10.phx.gbl...
> In a script I would like to have the approximate number
> of rows of a table.
> Is there an easy way to get the 'approximate' number
> of rows in a table without using count(*).
> ben brugman
>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment