Search
 
SCRIPT & CODE EXAMPLE
 

SQL

truncate table postgres

truncate my_table restart identity
Comment

truncate all tables in database postgresql

DO
$do$
BEGIN
   -- dangerous, test before you execute!
   RAISE NOTICE '%',  -- once confident, comment this line ...
   -- EXECUTE         -- ... and uncomment this one
   (SELECT 'TRUNCATE TABLE ' || string_agg(oid::regclass::text, ', ') || ' CASCADE'
    FROM   pg_class
    WHERE  relkind = 'r'  -- only tables
    AND    relnamespace = 'public'::regnamespace
   );
END
$do$;
Comment

truncate psql

TRUNCATE [ TABLE ] [ ONLY ] name [ * ] [, ... ]
    [ RESTART IDENTITY | CONTINUE IDENTITY ] [ CASCADE | RESTRICT ]
Comment

PREVIOUS NEXT
Code Example
Sql :: oracle trigger after logon on schema 
Sql :: update column data type postgres 
Sql :: sql count group by 
Sql :: how to check if a row is null in sql 
Sql :: sql substring before last occurrence of character 
Sql :: oracle sql date get month 
Sql :: give a column name to values generated from case statement in sql 
Sql :: sql select sum group by id laravel 
Sql :: postgres statistics 
Sql :: mysql select multiple rows into one column 
Sql :: install mysql on bash 
Sql :: SQL Server rename foreign key constraint 
Sql :: replace string value in sql 
Sql :: sql delete row with auto increment 
Sql :: mysql case when on date 
Sql :: datediff in sql server 
Sql :: drop table if exists test 
Sql :: describe table postgres 
Sql :: t sql null or empty string 
Sql :: inner join update 
Sql :: create index mysql 
Sql :: mysql search table in all databases 
Sql :: set open file limit mac catalina mysql 
Sql :: how to query without duplicate rows in sql 
Sql :: plpgsql create function 
Sql :: select random sql 
Sql :: linq join 
Sql :: how to create a table in sql 
Sql :: sum sqlalchemy 
Sql :: oracle sql concatenate results into string 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =