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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T02:10:27+00:00 2026-06-12T02:10:27+00:00

When deleting any Team from team table, i need to check that teamId is

  • 0

When deleting any Team from team table, i need to check that teamId is available in other tables or not. for this i am using following query:-

        select  count(TeamId) from 
        ( select TeamId from Project union all 
          select  TeamId from TeamMember union all 
          select  TeamId from Department union all 
          select TeamId from Role   union all 
        ) as Id where TeamId = 1

this query is working fine, and returns number of count.

but now i need name of that table and its column, where i found that teamId.

if it is possible than please give me right solution.

thanks in advance..

  • 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-12T02:10:28+00:00Added an answer on June 12, 2026 at 2:10 am
     select 'Project' tableName from Project
     where TeamId = 1
     union all 
     select 'TeamMember' from TeamMember
     where TeamId = 1
     union all 
     select 'Department' from Department
     where TeamId = 1
     union all 
     select 'Role' from Role
     where TeamId = 1
    

    I don’t see why you need the “column” where it was found, since in all cases you listed “TeamId”. If it were named different things in different tables instead, then you could use this:

     select 'Project' tableName, 'TeamId' columnName from Project
     where TeamId = 1
     union all 
     select 'TeamMember', 'Member_TeamId' from TeamMember
     where Member_TeamId = 1
    

    And finally, if you wanted the “row” (record) instead, you can add the ID into the column:

     select 'Project' tableName, ProjectID idInTable from Project
     where TeamId = 1
     union all 
     select 'TeamMember', TeamMemberId from TeamMember
     where TeamId = 1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi Experts How I can prevent database user deleting any data in tables using
I have two tables without any cascade deleting. I want to delete parent object
How would I rollback the last commit in git without deleting any changes? This
I am trying to merge two tables using the MERGE statement, is there any
My problem: My delete node method works fine for deleting any specified node from
I have a Delete Query that each day needs to run deleting any data
Is there any way of deleting the top most element of the queue in
When deleting a record from the database, occasionally I will run into a reference
Locally deleting a file followed by svn update restores the local copy of that
Is deleting a pointer same as freeing a pointer (that allocates the memory)?

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.