alejandrotecnimaq

alter sequence

Oct 27th, 2020
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. -- Get Max ID from table
  3. SELECT MAX(id) FROM table;
  4.  
  5. -- Get Next ID from table
  6. SELECT nextval('table_id_seq');
  7.  
  8. -- Set Next ID Value to MAX ID
  9. SELECT setval('table_id_seq', (SELECT MAX(id) FROM table));
Advertisement
Add Comment
Please, Sign In to add comment