I have created this blog to learn more and more about SSIS and Sql server.
Here you will find posts about Control Flow Task, Data flow transformation and lot more. I have tried to explain transformations and tasks through simple scenario and example.
I hope this would help you
Monday, April 22, 2013
Sql Server : How to get number of records in each table of a database?
Question: How to get number of records in each table of a database?
Solution:one way is to get count from each table by specifying table name, and another way is to use sp_msforeachtable stored procedure.
sp_msforeachtable 'select ''?'' ,count(*) from ?''
This stored procedure can also be used for various other operations also, these are as below:
How to get number of rows in some of the tables of a database
'if ''?'' in (''[dbo].[ABC]'')
select ''?'' as table_name , count(*) as number_of_rows from ? '
---how to get tables which are having 0 rows, or the emplty table
'select ''?'' as table_name , count(*) as number_of_rows from ? having count(*)=0'
--Alter all table and enable trigger on all of the table