SQL Server – foreach

sp_MSforeachtable can be very useful within SQL server.

To list empty tables:

To list tables having 1 or more rows: