I have sql file(single_table_data.sql
) that contains data of only one table(I have taken dump of only one table from server)
Now i have to insert this sql file in to only single table in my database,
so how to import sql file in to single table in postgres ?
Edit
For example i had database name SpeedData
and table name CurrentTable
, so now i want to
insert entire sql file data in to this table CurrentTable
Note: The sql file contains only insert statements
(not even create statements)
From the documentation:
psql dbname < infile
This should create a new table with the name of the previously dumped one and insert all data into it. Replace dbname
with the name of the new database and infile
with the name/path of the file containing the dump, in your case (single_table_data.sql
)
If the dump contains only the insert statements, create the table by hand and then execute
psql -U your_username -d dbname -f single_table_data.sql