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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T17:18:10+00:00 2026-05-17T17:18:10+00:00

So I am really confused on how to write this proc. Here is what

  • 0

So I am really confused on how to write this proc. Here is what needs to be done.

I have 3 tables laid out as follows:

tblObject {ObjectId, MasterId}

tblAnotherObject {ObjectId}

tblFurtherObject {ObjectId}

I need a proc that can delete the rows in ‘tblAnotherObject’ and ‘tblFurtherObject’ that contain an ‘ObjectId’ that does NOT have a matching ‘ObjectId’ in ‘tblObject’ that is paired with a passed in ‘MasterId’ to the proc.

I have been banging my head against a wall for hours today, and I have no clue how to write something like this…thank you so much ahead of time.

  • 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-17T17:18:10+00:00Added an answer on May 17, 2026 at 5:18 pm

    I need a proc that can delete the rows in ‘tblAnotherObject’ and ‘tblFurtherObject’ that contain an ‘ObjectId’ that does NOT have a matching ‘ObjectId’ in ‘tblObject’ that is paired with a passed in ‘MasterId’ to the proc.

    Use:

    DELETE FROM TBLANOTHEROBJECT
     WHERE NOT EXISTS(SELECT NULL
                        FROM TBLOBJECT o
                       WHERE o.masterid = @masterid
                         AND o.objectid = TBLANOTHEROBJECT.objectid)
    
    DELETE FROM TBLFURTHEROBJECT
     WHERE NOT EXISTS(SELECT NULL
                        FROM TBLOBJECT o
                       WHERE o.masterid = @masterid
                         AND o.objectid = TBLFURTHEROBJECT.objectid)
    

    Say tblObject contains a row that has MasterId = 4 and ObjectId = 15. I want to delete all rows in the other two tables that have ObjectId = 15.

    That’s the opposite – use:

    DELETE FROM TBLANOTHEROBJECT
     WHERE EXISTS(SELECT NULL
                    FROM TBLOBJECT o
                   WHERE o.masterid = @masterid
                     AND o.objectid = TBLANOTHEROBJECT.objectid)
    
    DELETE FROM TBLFURTHEROBJECT
     WHERE EXISTS(SELECT NULL
                    FROM TBLOBJECT o
                   WHERE o.masterid = @masterid
                     AND o.objectid = TBLFURTHEROBJECT.objectid)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am bringing out a separate question from here . It really confused me.
Trying to figure out the best way to accomplish this. I have inhereted a
Really stuck on trying to write code to unzip a file or directory on
I really want to write .NET apps that run on any platform (PC, Linux
This is a K&R exercise (1-13)... Write a program to print a histogram of
I'm very confused here as to why paperclip isn't working for me. When accessing
I am reading WIX script written by others. There are some code really confuses
Really simple question - how do I do a search to find all records
Really my question has more to do with the server-side scrubbing of html that's
I really feel that I should learn Lisp and there are plenty of good

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.