Search
 
SCRIPT & CODE EXAMPLE
 

SQL

postgresql reset auto increment

-- if you dont mind losing the data, do the following
TRUNCATE TABLE someTable RESTART IDENTITY;
Comment

postgresql reset auto_increment index

-- Change the starting value of the sequence

ALTER SEQUENCE project_id_seq RESTART 3000;

-- Same but dynamic :

SELECT SETVAL('project_id_seq', (SELECT MAX(id) + 1 FROM project));
Comment

PREVIOUS NEXT
Code Example
Sql :: postgresql datetrunc too slow 
Sql :: adding a default constraint to an existing column in sql 
Sql :: how to check all scheduled jobs in oracle 
Sql :: search for tables with name postgresql 
Sql :: t-sql test if table exists 
Sql :: tsql create unique index composite 
Sql :: select dba users oracle 
Sql :: key validation sql 
Sql :: import sql file laravel cmd 
Sql :: create table if not exists postgresql 
Sql :: query to check cpu utilization in oracle database 
Sql :: timestamp in sqlite 
Sql :: oracle list next running jobs 
Sql :: node and mysql like 
Sql :: sql server 2012 query history 
Sql :: sql server convert date to int 
Sql :: psql is not recognized 
Sql :: zerar auto increment mysql 
Sql :: query any digits record 
Sql :: sql change password wordpress 
Sql :: sql comment header 
Sql :: sql delete stored procedure 
Sql :: mysql select from outside 
Sql :: sql server for loop 
Sql :: inner join just one row 
Sql :: oracle alter table add not null constraint 
Sql :: show all users in mysql 
Sql :: mysql reset auto increment to 1 
Sql :: mysql shell ERROR: Not connected. 
Sql :: mysql select month and year 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =