How to Alter the Sequence Value in Postgresql

This script will change the value of the sequence value, for example we have a table EMPLOYEE and sequence EMPLOYEE_SEQ:
DROP SEQUENCE EMPLOYEE_SEQ_SEQ;
CREATE SEQUENCE EMPLOYEE_SEQ_SEQ start with 2 increment by 1;
The script will set the sequence to 2 and to be incremented by 1.

To alter a table:
alter table EMPLOYEE alter column money type NUMERIC(23, 2);

To alter a table and set a default value:
alter table CRM_PROVIDER alter column RATING_ROUNDING set default 2;

0 Comments

Post a Comment

Post a Comment (0)

Previous Post Next Post
NERV Open Source
Building production Spring Boot systems?

Explore NERV — open-source Java libraries for audit trails, persistence, exception handling, and reliable event-driven architecture.