Thursday 9 September 2010

Get the reference levels of all tables in a database.

Question:
We need a script to truncate tables in the right order to prevent Foreign Key violations.

Answer:
The script below can be used to determine the reference levels of all tables in a database.

Determine reference levels of all tables