Skip to content

Instantly share code, notes, and snippets.

@lisp-ceo
Forked from chandeeland/dump_wineries.sql
Last active August 29, 2015 14:13
Show Gist options
  • Save lisp-ceo/0653c6209ec263af2c0c to your computer and use it in GitHub Desktop.
Save lisp-ceo/0653c6209ec263af2c0c to your computer and use it in GitHub Desktop.
--
-- how to populate locations table on db2 from wineries table on db1
--
-- SELECT "INSERT INTO locations( name, website, address, address2, city, state, zip, country, phone, created_at, updated_at, latitude, longitude, email, fax, winery_id ) VALUES (" || name ||", " || website || ", " || address || ", null , null, null, null, null, " || phone || ", " || created_at || ", " || modified_at || ",null, null, " || email || ", " || fax || ", " || winery_id || "); " FROM wineries
SELECT 'INSERT INTO locations( name, winery_id ) VALUES ("' || name || '", "' || winery_id || '"); ' FROM wineries
--
-- pgsql [dbname] < dump_wineries.sql > output.sql
--
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment