I want to change some data in a table with _id_seq
suffix with this sql query:
UPDATE user_custom_fields_id_seq SET last_value = 1000;
but I get the following error:
ERROR: cannot change sequence "user_custom_fields_id_seq"
Is there anyway to bypass this error by using just SQL?
Sequences objects are created by using the CREATE SEQUENCE statement. Sequences are integer values and can be of any data type that returns an integer. The data type cannot be changed by using the ALTER SEQUENCE statement. To change the data type, drop and create the sequence object.
Use the ALTER SEQUENCE statement to change the increment, minimum and maximum values, cached numbers, and behavior of an existing sequence. This statement affects only future sequence numbers.
The syntax to a view the properties of a sequence in SQL Server (Transact-SQL) is: SELECT * FROM sys. sequences WHERE name = 'sequence_name'; sequence_name.
Use ATER SEQUENCE command:
ALTER SEQUENCE user_custom_fields_id_seq
RESTART WITH 1000;
user_custom_fields_id_seq
is not a table, it is a sequence.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With