Creating and using a database sequence