Search code examples
postgresqlschemadatabase-schemadata-migration

Migrating data from public schema to table in another schema in postgreSQL


I need to migrate data from multiple tables in the db public schema to one table in a schema called fs. Then I need to match the migrated data, now is the fs schema, to data in a different table in the fs schema.

Would something like this work?

INSERT INTO targetTable
SELECT * FROM [sourceserver].[sourcedatabase].[dbo].[sourceTable]

Very new to postgreSQL and SQL in general, so please let me know if clarification is necessary. Thank you.


Solution

  • This will work

    INSERT INTO Table2 (<columns>)
    SELECT <columns>
    FROM schema.Table1