  Extensive photometric surveys are and will continue producing massive amounts
of data on small bodies. Usually, these data will be sparsely obtained at
arbitrary (and unknown)rotational phases. Therefore, new methods to process
such data need to be developed to make the most of those large catalogs. We aim
to produce a method to create phase curves of small bodies considering the
uncertainties introduced by the nominal errors in the magnitudes and the effect
introduced by rotational variations. We use the SLOAN Moving Objects Catalog
data as a benchmark to construct phase curves of all small bodies in there, in
u', g', r', i', and z' filters. We will obtain from the phase curves the
absolute magnitudes and set up with them the absolute colors, which are the
colors of the asteroids not affected by changes in phase angle. We select
objects with $\geq3$ observations taken in at least one filter and spanned over
a minimum of 5 degrees in phase angle. We developed a method that combines
Monte Carlo simulations and Bayesian inference to estimate the absolute
magnitudes using the HG$_{12}^*$ photometric system. We obtained almost 15\,000
phase curves, about 12,000 including all five filters. The absolute magnitudes
and absolute colors are compatible with previously published data, supporting
our method. The method we developed is fully automatic and well suited to be
run on large amounts of data. Moreover, it includes the nominal uncertainties
in the magnitudes and the whole distribution of possible rotational states of
the objects producing, possibly, less precise values, i.e., larger
uncertainties, but more accurate, i.e., closer to the actual value. To our
knowledge, this work is the first to include the effect of rotational
variations in such a manner.
