Re: how to find a dbspace for a table
Posted in 2005
Topics: Storage & Space Management, SQL Development & Query Writing
select dbinfo("dbspace", partnum) , tabname from systables
where tabname ="yourtable";
if that throws
727: Invalid or NULL TBLspace number given to dbinfo(dbspace).
better:
select b.tabname , a.dbspace
from sysfragments a , systables b
where a.tabid = b.tabid and b.tabname = "yourtable"
Superboer
"Thanh Ngo" <t-ngo@ti.com> wrote in message news:<d48qgo$8ke$1@home.itg.ti.com>...
> Can someone show me how to find which dbspace a table is on in database?
>
> I used below SQL but dbspace shows as 0
>
> select trunc(partnum/16777216) dbspace,
> sum(nrows*rowsize) bytes,
> tabname
> from systables
> where tabtype = 'T'
> group by 1,tabname
> order by 1;
>
> Thanks for your help.
>
> Thanks,
> Thanh Ngo
Thanks for you response. It works great.
Thanks,
Thanh Ngo
"superboer" <superboer7@planet.nl> wrote in message
news:bb790a36.0504212207.4bbe8e48@posting.google.com...
> select dbinfo("dbspace", partnum) , tabname from systables
> where tabname ="yourtable";
>
> if that throws
> 727: Invalid or NULL TBLspace number given to dbinfo(dbspace).>
> better:
>
> select b.tabname , a.dbspace
> from sysfragments a , systables b>
> where a.tabid = b.tabid and b.tabname = "yourtable"
>
>
>
> Superboer
>
>
> "Thanh Ngo" <t-ngo@ti.com> wrote in message
news:<d48qgo$8ke$1@home.itg.ti.com>...
> > Can someone show me how to find which dbspace a table is on in database?
> >
> > I used below SQL but dbspace shows as 0
> >
> > select trunc(partnum/16777216) dbspace,
> > sum(nrows*rowsize) bytes,
> > tabname
> > from systables
> > where tabtype = 'T'
> > group by 1,tabname
> > order by 1;
> >
> > Thanks for your help.
> >
> > Thanks,
> > Thanh Ngo