COPY Bulk Data Transfer
The copybulkdatatransfer command loads large amounts of data from a file to populate a table.
COPY Bulk Data Transfer Syntax
sql format:
COPY _table[(_column1, _column2 ...)] from '_path' [WITH] _options;
JDBC case:
statement.execute("COPY public.t_copy2 from 'D:\\DB\\CSV\\t_copy2.csv' WITH DELIMITER ',' CSV HEADER");
.NET case: DbCommand dbCommand = conn.CreateCommand(); dbCommand.CommandText = "COPY public.t_copy2 from 'D:\\DB\\CSV\\t_copy2.csv' WITH DELIMITER ',' CSV HEADER"; int count = dbCommand.ExecuteNonQuery();