1

Is it possible to get information about whether a child table has reference to a parent table through a certain record? For example, tblParent has a record whose primary key value is 5. I want to know whether tblChild_A, tblChild_B and tblChild_C have one or more records in them where the foreign key value is 5. Well it's definitely possible by querying each of the child tables individually but I want to know whether there's any system query or stored procedure or whatever that produces a tabular output from all those tables together. If it's possible in MS SQL Server then please also inform what's its counterpart in MS Access. Regards.

Lots of arguments here. I want to know how this can be done in MSSQL Server as well as MS Access.

Alex Aza
  • 76,499
  • 26
  • 155
  • 134
priyamtheone
  • 517
  • 7
  • 22

2 Answers2

1

I described a possible solution on how to do this in SQL Server here: SQL Server: how to know if any row is referencing the row to delete.

Community
  • 1
  • 1
Alex Aza
  • 76,499
  • 26
  • 155
  • 134
  • How does that SQL Server answer help in Access? – David-W-Fenton Jun 15 '11 at 22:58
  • @David-W-Fenton - if I read the question correctly then both solutions needed MS SQL Server and MS Access. Yes, my answer is a half of the answer. – Alex Aza Jun 15 '11 at 23:13
  • The question says "If it's possible in SQL Server...what's the counterpart in Access". That is not asking for a SQL Server solution, but how to do it in Access IF it's doable in SQL Server. – David-W-Fenton Jun 17 '11 at 17:53
  • @David-W-Fenton - this is not how I understand the question. `If it's possible in MS SQL Server then please also inform what's its counterpart in MS Access`. As I read this, OP wants to know if this is possible in SQL server, and if it is possible, then they want to know how to do this in Access. – Alex Aza Jun 17 '11 at 18:07
  • I don't see how your interpretation saves your argument, as what the questioner is asking for is HOW TO DO IT IN ACCESS, not in SQL Server. – David-W-Fenton Jun 20 '11 at 19:40
0

Access/Jet/ACE offers no such system query/sproc for this purpose. You'd have to code it up individually, though if you wanted it to be generalized, you could use the TableDefs and Relationships collections to figure out what tables to look at.

David-W-Fenton
  • 22,871
  • 4
  • 45
  • 58