This Script will Generate a Script as a ResultSet, which need to be run to create Foreign Keys, or could be saved for future use.
This is a useful script to Regenerate Foreign Key Constraint , if its been deleted accidently or on purpose, and situation can be critical if those constaints name are been used within our Application code,
When you run the script it will give you 2 ResultSets, First one is information about fetched Foreign Keys , and other one is Alter Script to add those foreign keys in corresponding tables.
You can save that Second ResultSet to use as a whole or as a part to recover any Foreign Key.
There is a drawback in the script, i.e For Composite Foreign Keys, it generates create command twice, which cause an error, which needs to be fix manually. In this case you need to delete second command and modify first one with appropriate syntax.
See you next time guys....