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

  • Home
  • SEARCH
  • 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 5973639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:49:43+00:00 2026-05-22T20:49:43+00:00

How to compare a table against a table variable in a Stored Procedure? Normally

  • 0

How to compare a table against a table variable in a Stored Procedure? Normally to compare the two tables we used this query:

 SELECT * 
 FROM Table A 
 WHERE NOT EXISTS(SELECT * 
                  FROM Table B 
                  WHERE Table A.ID = Table B.ID)

But here, I have Table A and one table variable @Item like Table B.

In this scenario, how to compare Table A and @Item?

I am writing one stored procedure, in that stored procedure I want to compare the existing one table with the table variable which is generated from the front end and passed as a XML dataset to the Stored Procedure…
In that, if all the rows in the table variable @Item presents in the existing table then it returns true else false…

Any suggestions please….

  • 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-05-22T20:49:44+00:00Added an answer on May 22, 2026 at 8:49 pm

    If works just the same (altough using table aliases will make it easier)

    SELECT * 
    FROM Table A 
    WHERE NOT EXISTS(
        SELECT * 
        FROM @Item sub 
        WHERE Table A.ID = sub.ID
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to compare two tables and then update if some logic is
When you need to compare two tables to see what the differences are, are
What is a free tool to compare two Sql Server tables (data and schema).
Assuming I have two SQL tables consisting of a single column, i.e. Table 1
I have a query that needs to compare a value against multiple columns, and
First up: we are not doing TPH (table per hierarchy), that would make this
I'm designing a dynamic SQL-query that will check a source-table against a target table.
I have a table of classroom names that I want to compare against several
I'd like to take a table, generate it's hash string, store it, then compare
I need to compare the answer in with the aspnet_membership tables PasswordAnswer value. The

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.