Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8205905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T08:27:18+00:00 2026-06-07T08:27:18+00:00

I have more than 3 sql tables. now i’m trying to select count(*) from

  • 0

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
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T08:27:22+00:00Added an answer on June 7, 2026 at 8:27 am
    Select 
        case when count(*) = 0 then 
            'No rows' 
        else 
            'Has rows'
        end 
    FROM
    (
       Select * from @table1
       UNION ALL
       Select * from @table2
       UNION ALL
       Select * from @table3
    ) t
    

    UPDATE

    This makes sure all of then have at least one row and fail if any of them does not have record

    Select 
        case when count(*) = 0 then 
            'No rows' 
        else 
            'Has rows'
        end 
    FROM
    (
       Select top 1 1 found from @table1
       intersect
       Select top 1 1 found from @table2
       intersect
       Select top 1 1 found from @table3
    ) t
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables in SQL Server: article prices Now I want to select
I have a SQL Server database which has grown to more than 15GB in
I have more than 100 million unique strings (VARCHAR(100) UNIQUE in MySQL database). Now
How can one have more than a Wizard control on the same page without
This is more of a conceptual question than anything. I have a base class
I was a MySQL user. Now I'm migrating to SQL Server. But I have
I have a table in SQL with more than 1 million records which I
Let's say we have a field that can be in more than one type,
I'm stuck in this problem for quite while now. I have two tables ItemMaster
I have more than 400 000 id's in NOT IN statement. Whether it will

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.