I need a query for SQL Server 2000 to get a list of all foreign keys.
Particularly all the foreign keys that point to a particular column.
How do I write this query?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
That should do the trick and be compatible with SQL Server 2000, I hope!
If you additionally need the table and column information in SQL Server 2000, it gets a bit more involved; you need to join the
sysforeignkeysandsyscolumnscatalog views like so:And if you want to leverage the INFORMATION_SCHEMA views which ARE indeed available in SQL Server 2000, use this query:
Marc