2. $a_{1}, a_{2}, \cdots, a_{10}$ represent the ten digits $1,2,3,4,5,6$, $7,8,9,0$, respectively, to form two five-digit numbers
$$
m=\overline{a_{1} a_{2} a_{3} a_{4} a_{5}}, n=\overline{a_{6} a_{7} a_{8} a_{9} a_{10}}(m>n) .
$$

Then the minimum value of $m-n$ is
2.247.

Since $m>n$, we have $a_{1}>a_{6}$.
To make $m-n$ as small as possible, we should take $a_{1}-a_{6}=1$, the last four digits of $m$ should be the smallest, and the last four digits of $n$ should be the largest. The largest four-digit number that can be formed from the different digits 1,2,3,4,5,6,7,8,9,0 is 9876, and the smallest four-digit number is 0123. The remaining two numbers are 4,5. Then, taking $a_{1}=5, a_{6}=4$, we get $m=50123, n=49876$. Therefore, $m-n=247$.