I would like to return all the tables and its count next to it. what is the quickest way to go about it?
I know in Oracle, you can do something like below, but not sure about Sybase:
declare n number;
begin
for rec in (select object_name from user_objects where object_type='TABLE')
loop
execute immediate 'select count(*) from '||rec.object_name into n;
dbms_output.put_line (rec.object_name||':'||n);
end loop;
end;
Here is the Sybase sql that does the above:
select ob.name,st.rowcnt
from sysobjects ob, systabstats st
where ob.type="U"
and st.id=ob.id
order by ob.name
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With