Thanks for sharing! In SQL Server, you can also use sp_MSforeachtable.
The sp_MSforeachtable procedure is an undocumented stored procedure in SQL Server that executes a given command for each table in the database.
Executing the following command returns a list of tables that contain data: EXEC sp_MSforeachtable 'IF EXISTS (SELECT 1 FROM [?]) PRINT ''Table: ? contains data'''
Thanks for sharing! In SQL Server, you can also use sp_MSforeachtable.
The sp_MSforeachtable procedure is an undocumented stored procedure in SQL Server that executes a given command for each table in the database.
Executing the following command returns a list of tables that contain data:
EXEC sp_MSforeachtable 'IF EXISTS (SELECT 1 FROM [?]) PRINT ''Table: ? contains data'''Thank you Spyros for sharing this. it will be helpful to the community