ap_compare_fkeys_sp

This is intended to be an internal procedure.

 

Compares the foreign keys for two tables to see if there have the same definition and mirrors the definition of the keys of @left to @right, leaving those that are the same untouched. That is, fkeys in @right that are missing and different in @left are dropped, and fkeys in @left not in @right or different are added. fkeys not in @subsystem are ignored.

 

Constraints in left table must not be disabled or non-trusted. Constraints in right table that are disabled or non-trusted will be dropped and created.

 

@left and @right must be in different schemas . else constraints cannot have the same name.