Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Foreign keys

Status
Not open for further replies.

mahua

Technical User
Oct 9, 2003
6
US
Need a query to find out all tables in a database that uses foreign keys & constraints , drop them & then recreate them in the same way so as not to affect the database.

Please mail at mahua_saha@hotmail.com
 
Hi
You can form a query


select distinct a.name from sysobjects a, sysobjects b
where a.id = b.parent_obj and b.type in ('F','C')

and then use SQL DMO to generate the scripts to recreate these objects.

Hope this helps..

Rgds
Kudlaguy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top