Hi,
To demagnetise metal you have to scatter the orientation of the magnetic fields of each individual atom.
This can be achieved by a few methods.
Heat the metal up past its Curie point.
Hit the metal multiple times really hard.
Move an opposing magnetic field against the metal's magnetic field multiple times. This is usually done with a Degaussing unit which cycles a strong magnetic field 50 or 60 times a second against the object to be demagnetised. If you've ever seen a tape wiping machine (for old magnetic tape) then this is Degaussing unit.
Now since the compass is able to float - it always links its magnetic field to the opposing field of the steel - so it doesn't have an opposing field forced against it since it can just move with the field. The floating action also acts as a shock absorber so impacts don't affect compasses. The only thing you have to worry about is heat. The Curie point for iron is about 700 Celsius - about 1300 fahrenheit.
I hope this helps.
Cheers,
Harley.