• Hello, Michael.

    An excellent stored procedure.

    It would be beneficial to create this in a database where all database utilities are stored and send the fks database name as an additional parameter. That way the stored procedure, functions, etc., will be in only one database and can be executed from the utilities database against any other database.

    The benefits would be that you have the new objects in one database. Any updates/changes to the process would be done in only one place.

    You'd need to redo some of the t-sql as dynamic sql and string the database name parameter into the t-sql stream. Maybe this change can be made in an update?

    Once again, a very useful stored procedure! Thanks.