[psql] copy

kimmjk3·2022년 12월 14일
0

[LINUX]

exeport

  • .sh
PGPASSWORD=[PASSWORD] psql -h [host] -U [ID] -d [DB NAME] -f [.sql파일]
  • .sql
\copy (select * from [테이블명]) to '[경로]' WITH (NULL 'null', DELIMITER E'\t', ENCODING 'UTF8');

import

  • .sh
PGPASSWORD=[PASSWORD] psql -h [host] -U [ID] -d [DB NAME] -f [.sql파일]
  • .sql
\copy [테이블명] from '[경로]' WITH (NULL 'null', DELIMITER E'\t', ENCODING 'UTF8');

[WINDOW]

import

  • .bat
set PGPASSWORD=[PASSWORD]
cd [postgreSQL경로]\postgreSQL\13\bin
psql -h [host] -U [ID] -d [DB NAME] -f [경로].sql
  • .sql
\copy [테이블명] from program'cmd /c "type [경로].txt"' WITH (NULL 'null', DELIMITER E'\t', ENCODING 'UTF8');
profile
kimmjk3

0개의 댓글