Thursday, January 5, 2017

How to find out which Table is not having rows in SQL Server?

Declare @tableRowCount Table
(
TableName Varchar(300),
RowCnt INT
)
Insert into @tableRowCount
EXEC sp_msforeachtable 'select parsename(''?'',1), count(*)  from ?'
select * from @tableRowCount
where RowCnt! = 0 ---(rowcnt=0 is not having any records)
order by RowCnt

No comments:

Search This Blog

DAX - Grouping on multiple columns and the count

Please go thorugh the below URL for entire soultion. http://community.powerbi.com/t5/Desktop/DAX-Grouping-on-multiple-columns-and-the-cou...