Use sp_optgoal to create a user-defined optimization goal. The syntax is:
sp_optgoal "goal_name", "save"
where:
goal_name – which cannot be longer than 12 characters, is the name of the goal you are creating.
save – creates the goal if it does not already exist
See the Reference Manual: Procedures.
This example creates a goal called goal_1571, which:
Sets the optimization level to ase157ga
Sets the optimization goal to allrows_mix
Enables hash joins
Enables the optimization criteria for CR # 123456
Disables the optimization criteria for CR # 234234:
set plan optlevel ase157ga set plan optgoal allrows_mix set hash_join 1 set CR123456 1 set CR234234 0 go execute sp_optgoal "goal_1571", "save" go