Postgresql change auto-increment

How to change postgresql auto-increment database field, similar to
"ALTER TABLE tbl AUTO_INCREMENT = 500" in MsSQL database?
Who is Participating?
You want to set the sequence to a different number?

Check the postgresql sequence documentation at:

In general you can use the code below to set the value.

-- Set the value of a sequence to 300
SELECT setval('schemaname.sequencename', 300);

Open in new window

Undocomented nonstandard MS SQL feature is not implemented in PostgreSQL and is unlikely to ever be present in any database out there.

chiabpAuthor Commented:
You mean there is no way for postgresql database to change the auto-increment number? I have search from internet, there is "setval()" function in postgresql, but I not sure how to use it, any ideas?

My purpose just simple to change my auto-number, example from 200 to 300

thank you
There is no documentation for MS SQL AUTO_INCREMENT=int table attribute.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.