toniupstny (8/10/2008)
An alternative without cursor is:sp_msforeachtable 'select ''?'', count(*) Rows from ?'Toni
Ummm.... not quite correct, Toni. If you go and look at the code for sp_MSForEachTable, you'll find a monster cursor that is typically slower than any cursor you would ever intentionally build because it was written to handle just about any size code. The cursor that Hari wrote will likely run much faster than using sp_MSForEachTable.
--Jeff Moden
Change is inevitable... Change for the better is not.