Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Child tables accessing UNIQUE constraint.

Author  Topic 

ravilobo
Master Smack Fu Yak Hacker

1184 Posts

Posted - 2008-05-08 : 13:18:49
What query gives me the list of child tables accessing a unique key (But Not PK) for a given table?

For. E.g. In the folloiwng scenario I should get o/p as t3

create table t1 (id1 int primary key , id2 int unique )

create table t2 (id1 int references t1(id1))
create table t3 (id2 int references t1(id2))


------------------------
I think, therefore I am - Rene Descartes

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-05-08 : 14:18:10
Have a look at INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE catalog view to get a start on this.
Go to Top of Page

ravilobo
Master Smack Fu Yak Hacker

1184 Posts

Posted - 2008-05-08 : 14:51:26
Thanks visakh16!

I got the information from - INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS. Thanks anyway.

------------------------
I think, therefore I am - Rene Descartes
Go to Top of Page
   

- Advertisement -