sql server - Check for an specific id or value in multiple tables -


Let's say we have a table A with the primary key column ID. Now this table is in a foreign key relationship with other tables on this column.

I need to create a stored procedure that will take the id as a parameter and return a value of 1 or 0 depending on the value of the id. Is present in any other table.

For the former, if id = 3 and any N table should give 3 SP to 1 and 0.

What is the best way to get it?

One way to run various selected questions and to process each result

thanks

  If Existing (Select * Join an INNER at B.Id = Join BID Inner C. A.Id = C.Id at INNER. AID = Go to DID) Choose Start 1, or select Start 0 END  

A fairly straightforward approach to Johann I'm sure it is possible to do this by using System Tables It is possible for those who are using the relationships they have met there, but it will be a lot of effort. Do these applause vary sufficiently to make it suitable?


Comments