By default, hash joins are enabled only when you run allrows_dss optgoal. To override the server level setting, and allow use of hash join in a session or stored procedure, use set hash_join on.
To enable hash joins, use:
set hash_join on
To disable hash joins, use:
set hash_join off