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 8198771
In Process

The Archive Base Latest Questions

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

In my procedure I have two tables with the same data. I go through

  • 0

In my procedure I have two tables with the same data. I go through my first table through a cursor. Which compares with the second table that I find much the same data. What if, for example in my table_1 I have ten in my data and I have 12 data table2 how to detect missing data in my two table_1 which is traversed by the cursor?

Thx.

  • 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-07T06:01:20+00:00Added an answer on June 7, 2026 at 6:01 am

    Sounds very much like you’d be better off using the MINUS operator.

    SELECT a, b, c
    FROM table1
    MINUS
    SELECT a, b, c
    FROM table2
    

    This will show you all results that exist in table1 which are not present in table2. In order to show discrepancies both ways, you could do something like this:

    SELECT z.*, 'In table1, not in table2' problem_description
    FROM (
      SELECT a, b, c
      FROM table1
      MINUS
      SELECT a, b, c
      FROM table2   
    ) z
    UNION ALL
    SELECT z.*, 'In table2, not in table1' problem_description
    FROM (
      SELECT a, b, c
      FROM table2
      MINUS
      SELECT a, b, c
      FROM table1   
    ) z
    

    SQL Fiddle for this answer

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two processes that work with data in the same table. One process
I have two cursors in my procedure that only differ on the table name
I have two tables with hierarchyid fields, one of which is a staging table
I have a stored procedure that takes no parameters, and it returns two fields.
I have two sources of clinical procedure billing information that I have added together
I have two servers, the first one with SQL Server 2005 and the second
I have two tables, custassets and tags . To generate some test data I'd
I have two tables, where only one column is the same. I am trying
I have two tables with the exact same columns. Both have primary identity keys
I have a situation like, I have two tables having same structure. I have

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.