Search
 
SCRIPT & CODE EXAMPLE
 

SQL

psql change table schema

ALTER TABLE myschema.distributors SET SCHEMA yourschema;
Comment

change schema of all tables postgres

DO
$$DECLARE
   p_table regclass;
BEGIN
   SET LOCAL search_path='xyz';
   FOR p_table IN
      SELECT oid FROM pg_class
      WHERE relnamespace = 'xyz'::regnamespace
        AND relkind = 'r'
   LOOP
      EXECUTE format('ALTER TABLE %s SET SCHEMA public', p_table);
   END LOOP;
END;$$;
Comment

PREVIOUS NEXT
Code Example
Sql :: django mssql backend 
Sql :: sqlalchemy left join 
Sql :: mysql add column 
Sql :: mysql select where starts with 
Sql :: mysql select if empty result 
Sql :: sql DATE = GETDATE() 
Sql :: sql server sleep 
Sql :: sql unique rows 
Sql :: sql trim all spaces 
Sql :: update column data type postgres 
Sql :: calculate distance between two latitude longitude postgresql 
Sql :: regex mongoose 
Sql :: sql identity column reset 
Sql :: is between inclusive or exclusive sql 
Sql :: install mysql on bash 
Sql :: postgres check for foreign key 
Sql :: mysql create database utf8 
Sql :: mysql update column default value CURRENT_TIMESTAMP error 
Sql :: define a variable in mysql from select 
Sql :: how to extract year from date in sql 
Sql :: mysql check datetime equals date 
Sql :: oracle show procedures 
Sql :: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client vs code 
Sql :: SQL Auto Increment Primary Key - PostgreSQL 
Sql :: zsh-syntax-highlighting zsh-autosuggestions 
Sql :: xampp import sql file command line 
Sql :: sql change a colum to unique 
Sql :: select random sql 
Sql :: sql server convert date to weekday 
Sql :: print integer and string in SQL 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =