Queries for updating sequences are in a seperate SQL script.
Added aspect for fixing corrupted sequences after DB crash, issue #635.
Merge branch 'sequences'