2. In decimal notation, how many $m \in\{1,2, \cdots, 2009\}$ are there such that there exists $n \in \mathbf{N}^{*}$, satisfying: $S\left(n^{2}\right)=m$? Here $S(x)$ denotes the sum of the digits of the positive integer $x$.
2. Notice that, perfect squares $\equiv 0,1,4,7(\bmod 9)$, and for $k \in \mathbf{N}^{*}$, let $n=$ $\underbrace{11 \cdots 1} \underbrace{22 \cdots 25}$, then $S(n)=3 k+4$, and
$k-1$ 个 $\underbrace{2+0}_{k \text { 个 }}$
$$\begin{aligned}
n & =\frac{10^{k-1}-1}{9} \times 10^{k+1}+\frac{2 \times\left(10^{k}-1\right)}{9} \times 10+5 \\
& =\frac{1}{9}\left(10^{2 k}-10^{k+1}+2 \times 10^{k+1}-20+45\right) \\
& =\frac{1}{9}\left(10^{2 k}+10 \times 10^{k}+25\right) \\
& =\frac{1}{9}\left(10^{k}+5\right)^{2}=(\underbrace{33 \cdots 35}_{k-1 \uparrow})^{2}
\end{aligned}$$

That is, $n$ is a perfect square.
By setting $k=3 t+2,3 t, 3 t+1, t \in \mathbf{N}$, and combining $S\left(1^{2}\right)=1$, we can see that for any $m \in\{0,1,2, \cdots, 2009\}$, if $m \equiv 1,4$ or $7(\bmod 9)$, then there exists $n \in \mathbf{N}^{*}$, such that $S\left(n^{2}\right)=m$.

Furthermore, for $k \in \mathbf{N}^{*}, n=\underbrace{99 \cdots 9}_{k \text { 个 }}$, we have
$$\begin{aligned}
n^{2} & =\left(10^{k}-1\right)^{2}=10^{2 k}-2 \times 10^{k}+1 \\
& =\underbrace{99 \cdots 9}_{k-1 \uparrow} \underbrace{00 \cdots 01}_{k-1 \uparrow},
\end{aligned}$$

Thus, $S\left(n^{2}\right)=9 k$. Therefore, when $m \equiv 0(\bmod 9)$, there also exists $n \in \mathbf{N}^{*}$, such that $S\left(n^{2}\right)=$ $m$.

The above discussion shows that the number of numbers that meet the condition is $\frac{4}{9} \times 2007+1=893$.