473,394 Members | 1,865 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

getting tables that link to a table

Hi,

How can I run a query to figure out what tables and corresponding
columns link to any column in my table T?

Thanks, - Dave
Apr 2 '08 #1
1 1328
Try

SELECT obj.name AS ChildTable, col.name AS ChildColumn, obj2.name AS
ParentTable, col2.name AS ParentColumn
FROM sysforeignkeys fk
JOIN syscolumns col on col.id= fk.fkeyid and col.colid= fk.fkey
JOIN syscolumns col2 on col2.id=fk.rkeyid and col2.colid= fk.rkey
JOIN sysobjects obj on col.id=obj.id
JOIN sysobjects obj2 on col2.id=obj2.id

This will give you all of the foreign key relationships. Add a WHERE
clause to narrow it down to one table.

Bill E.
Hollywood, FL

Apr 2 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

44
by: Mariusz Jedrzejewski | last post by:
Hi, I'll be very grateful if somebody can explain me why my Opera 7.23 (runing under linux) doesn't show me inner tables. Using below code I can see only "inner table 1". There is no problem with...
10
by: Job Lot | last post by:
Is there any way to programmatically link access tables using vb.net
7
by: KathyK | last post by:
Hi and thanks in advance! I have an Access 2000 front end and a SQL Server 2000 back end. When the Access main form opens I run code that logs the user on to the SQL server using the generic read...
2
by: Joe | last post by:
Hi All, I am new to using the Access DB and I need some help if someone is able to give it to me. What I want to do is get the names of the columns of certain tables. Not the data in the table...
3
by: Scotty | last post by:
I have a database which is made up of several tables "contacts", "coaching", "clubs" etc. The Contact and coach tables are linked by an "ID" field. The Contact and clubs table are linked a by a...
6
by: Don Leverton | last post by:
Hi All, I've got a situation where I am developing an Access 97 app for a client, and am in the "beta testing" stage. I have split the app up, using the DB splitter, into front-end /back-end...
3
by: Brenda | last post by:
How can I change the name of a table as I import it? I have a form in Access that needs to accept files from different sources (mainly dBase III). I need one field out of these tables, called...
2
by: Randy | last post by:
I am trying to relink some Oracle tables in an Access database via VB.NET and ADOX. I receive the following error when executing the cat.ActiveConnection link "Arguments are of the wrong type,...
3
by: BrianDP | last post by:
I have a database with a split front end/back end. There is a key table in the back end called Catalog, and it is sort of a central key table for all sorts of things. It's a list of all the jobs...
3
by: blue875 | last post by:
Ok, I've tried searching, and haven't found the answer, so it must mean everyone else but me already knows this. I have an Access 2000 form that I want to connect to an Access 2000 table in the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.