Skip to content

Instantly share code, notes, and snippets.

@soiqualang
Created November 13, 2019 03:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save soiqualang/bd4f96d34c3456bc53c3385b9653f00c to your computer and use it in GitHub Desktop.
Save soiqualang/bd4f96d34c3456bc53c3385b9653f00c to your computer and use it in GitHub Desktop.
PostgreSQL VS Excel, CSV

psql2csv

COPY texexcel FROM 'D:\tmp\QuyTrinh_Full_v2_2.csv' WITH CSV HEADER; --chay ok COPY "CongDoan"("CongDoanID","TenCongDoan","HanhDong","Thutu","ThoiGianToiDa","NhomID","GhiChu","QuiTrinhID") FROM 'D:\tmp\QuyTrinh_Full_v2_2.csv' CSV HEADER DELIMITER ',';

psql2csv

copy dbo."DoanhNghiep" to 'C:\Users\Administrator\Desktop\l4\doanhnghiep.csv' csv;

csv2psql

COPY dbo."DoanhNghiep" FROM 'D:\tmp\doanhnghiep.csv' WITH CSV HEADER;

copy dbo."ThongTinDuAn" to 'C:\Users\Administrator\Desktop\l4\ThongTinDuAn.csv' csv;

View2csv

copy (select * from public.hanhnghekhoannuocduoidatviewvn2000) to 'D:\tmp\psql2csv\hanhnghekhoannuocduoidatviewvn2000.csv' csv;


COPY texexcel FROM 'D:\tmp\QuyTrinh_Full_v2_2.csv' WITH CSV HEADER;

COPY texexcel(STT,QuyTrinh,"NhomThucHien","TenCongDoan","HanhDong","ThuTu","Timeout","KetQua","GhiChu") FROM 'D:\tmp\QuyTrinh_Full_v2_2.csv' CSV HEADER DELIMITER ',';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment