Skip to content

Instantly share code, notes, and snippets.

@maravilloso
Last active December 18, 2015 09:39
Show Gist options
  • Save maravilloso/5763111 to your computer and use it in GitHub Desktop.
Save maravilloso/5763111 to your computer and use it in GitHub Desktop.
Listar todas las FK's de la BD
SELECT CAST(a.tabname AS VARCHAR(15)) AS tabla,
CAST(constrname AS VARCHAR(20)) AS FK,
CAST(d.tabname AS VARCHAR(15)) AS referenciada,
delrule
FROM systables a, sysconstraints b, sysreferences c,
systables d
WHERE b.constrtype = 'R'
AND a.tabid = b.tabid
AND b.constrid = c.constrid
AND c.ptabid = d.tabid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment