From: Gilbert Tordeur on
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


From: Tom Dacon on

"Gilbert Tordeur" <gilbert.tordeur(a)orange.fr> wrote in message
news:epHLDvm1KHA.3744(a)TK2MSFTNGP04.phx.gbl...
> 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

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

Or try
http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.management.smo.table.foreignkeys.aspx
if you want to keep using SMO.

Not familiar enough with SMO to know if you can query all FKs in one go...

--
Patrice



From: Gilbert Tordeur on
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


From: Gilbert Tordeur on
Hi Patrice.

Wonderful !

Thank you,
Gilbert.