That spam comes from config.php, index.php and other hacked php files of your site - not from database.
Time to upgrade your whole site (at least clean spam code from config.php and upgrade all files of your moodle package) - and read http://docs.moodle.org/en/Security_overview