Tag Info

New answers tagged

2

You can import your .csv file and replace after: Make your date column new_date_column VARCHAR(10). Import the file. UPDATE with REPLACE. UPDATE db1.table1 SET new_date_column = STR_TO_DATE(REPLACE(new_date_column,'/','.'),GET_FORMAT(DATE,'EUR')); Change the datatype of new_date_column. ALTER TABLE db1.table1 MODIFY new_date_column ...


1

Since this is Windows we are dealing with, either use the double backslash LOAD DATA LOCAL INFILE 'C:\\Users\\userName\\Downloads\\tableName.csv' INTO TABLE tableName FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' or the forward slash LOAD DATA LOCAL INFILE 'C:/Users/userName/Downloads/tableName.csv' INTO TABLE tableName FIELDS TERMINATED BY ',' ...


0

This is not possible. To create table you need a table schema. What you have is a data file. Schema cannot be created with it. What you can do is check if your file has header row. In that case you can create table using that header row but manually. However there is a way to generate create table statement by a batch file as described by John Swapceinski ...


1

Basics: The 1st row of the CSV file has column names of defined format. The PROGRAM clause of COPY and GET DIAGNOSTICS after COPY require Postgres 9.3+. format() requires Postgres 9.1+ This works with pure standard Postgres - except for the head command that the shell is expected to provide. For Windows versions consider: How to do what head, tail, more, ...



Top 50 recent answers are included