How can I list all foreign keys referencing a given table in SQL Server

De openkb
Aller à : Navigation, rechercher

Sommaire

Questions

I need to remove a highly referenced table in a SQL Server database. How can I get a list of all the foreign key constraints I will need to remove in order to drop the table?

(SQL answers preferable over clicking about in the GUI of the management studio.)

Answers

Not sure why no one suggested but I use sp_fkeys to query foreign keys for a given table:

EXEC sp_fkeys  TableName 

Source

License : cc by-sa 3.0

http://stackoverflow.com/questions/483193/how-can-i-list-all-foreign-keys-referencing-a-given-table-in-sql-server

Related

Outils personnels
Espaces de noms

Variantes
Actions
Navigation
Outils