Order of Primary Key and/or Unique Key are different from Foreign Key in Generate Schema Script.
Foreign Key
1. Generate Schema Script | Object Types| unselect all, check just Foreign Key under Constraints
2. Generate Schema Script | Script Options | check "Include Drop Statements"
3. Click the green play button to generate the script
All of the ALTER TABLE ... DROP CONSTRAINT statements are listed first for all the Foreign Key (FK) constraints. Midway through the script it then starts to list all of the ALTER TABLE ... ADD CONSTRAINT statements. This is good because if there is a need to drop all the FK constraints, the ALTER TABLE ... DROP CONSTRAINT statements can be quickly copy and paste out of this script.
Primary Key and/or Unique Key
1. Generate Schema Script | Object Types| unselect all, check either or both Primary Key and Unique Key under Constraints
2. Generate Schema Script | Script Options | check "Include Drop Statements"
3. Click the green play button to generate the script
The ALTER TABLE ... DROP CONSTRAINT is followed by the ALTER TABLE ... ADD CONSTRAINT for each constraint consecutively. This doesn't provide an option to drop all the Primary Key and/or Unique Key constraints as conveniently as it is for FK constraints.
How to sort the order in Generate Schema Script for Primary Key and/or Unique Key so it is similar to the Foreign Key?