A csv file was exported from PostgreSQL database, but the exported file could not be imported into SQL Server, but same csv was easily imported into PostgreSQL.
Query to export was:
copy(select * from tablename where columnname = 'z') to '/path'
A csv file was exported from PostgreSQL database, but the exported file could not be imported into SQL Server, but same csv was easily imported into PostgreSQL.
Query to export was:
copy(select * from tablename where columnname = 'z') to '/path'
As mentioned in the comments, that statement does not create a CSV file. The correct syntax is:
copy(select * from tablename where columnname = 'z') to '/path/file_name.csv' delimiter ',' csv header;
A brief description of the options is below. See the documentation for more details.