Thursday , June 13 2024

Import Dat File Into PostgreSQL

In today’s article we will cover the topic of Import Dat File Into PostgreSQL.

Sometimes we need to import/export some tables in PostgreSQL. In this article, we will import the .dat file on PostgreSQL into the table. While doing this, we will do it through pgadmin, which is the simplest and easiest way.

First of all, we need to create a table that will match the columns in our file with the “.dat” extension to import.

We created our table as above.

NOTE: If the table is not created, the import\export command will not work.

After right-clicking on the table, we click on the import\export button.

In the Filename section, we go to the location of our .dat file and select our .dat file.

After selecting our .dat file, we come to the next section in the Format window and select the “binary” part.

After selecting Filename and Format in the above figure, pressing the “ok” key, we will transfer our .dat file to the table by running the copy command below on the back side.

As can be seen above, our 1000 records have been successfully transferred into the table.



About Faruk Erdem

Leave a Reply

Your email address will not be published. Required fields are marked *