Get the count of rows in the respective tables using cursors

Database
KVB
Enthusiast

Get the count of rows in the respective tables using cursors

Hi

 I have a scenario like

If I fired a query ,i will be getting a list of tables.In addition to that,I need to get the count of that tables.

What I thought is to make use of cursors inside a procedure,where the cursor row will process the each table once so that we can get row count for e ach table.

Please let me know if there are any better options.

I have seen the stats option but we are not sure that the stats may update.

Thanks

KVB

2 REPLIES
Junior Contributor

Re: Get the count of rows in the respective tables using cursors

If you need an exact count the only reliable way is to run a COUNT(*).

If doesn't have to be exact, extracting it from stats uses no additional resources.

Dieter

Re: Get the count of rows in the respective tables using cursors

Hi KVB,

I have a requirement to implement the same scenario you asked about. May i know how did you achieve that?

Thanks.