How to get the list of all SQL Server foreign keys in a database by using Microsoft.SqlServer.Manage

  • Thread starter Thread starter Gilbert Tordeur
  • Start date Start date
G

Gilbert Tordeur

Hello.

I have found many post telling how to create a foreign key with SMO but no
one explaining how to list them.

Anybody knows ?

Thank you,
Gilbert
 
Gilbert Tordeur said:
Hello.

I have found many post telling how to create a foreign key with SMO but no
one explaining how to list them.

Anybody knows ?

Thank you,
Gilbert

On SQL Server, it's:

select * from sys.foreign_keys

works for sure on SQL Server 2005, don't know about others.

Tom Dacon
Dacon Software Consulting
 
Hi Tom.

Many thanks for your answer.

In fact I was looking for an answer using SMO, independent of any SQL Server
version and more appropriate - for me - with dotnet spirit. Another post
gave me the answer.

Regards,
Gilbert
 
Back
Top