I have more than 3 sql tables.
now i’m trying to select count(*) from all tables but how can i do this?.
I want to know whether data is present in all tables or not
I need to check the row count from previous business day ~15% for any table and it sends an email alert
I tried like following please help me to complete
PROCEDURE [dbo].[SendEmail_WSOTableDataAlert]
AS
BEGIN
declare @err int
IF NOT EXISTS (select 1 from T1) OR
NOT EXISTS (select 1 from T2)
BEGIN
set @error=1
END
//here i need to show which table is having empty data how can i do this please help
SET @tableHTML = @tableHTML + +
'</TABLE>' + @EmailFooter;
@error =1
then
send mail
END
UPDATE
This makes sure all of then have at least one row and fail if any of them does not have record