I want to get relations (or foreign keys) of a Sql Server Table in my c# code.
How can i do this?
Thank you
I want to get relations (or foreign keys) of a Sql Server Table in
Share
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.
This will get all the foreign keys that
dbo.YourTableNamereferences:If you want to get all the foreign keys that reference
dbo.YourTableName, it’s only slightly different:You can put this in a stored procedure, parameterize the two-part name you pass into the
OBJECT_IDfunction, and then call the stored procedure from your C# code.