Shubham
Shubham

Reputation: 33

How to use PROGRAM clause of Postgres COPY command with Powershell command

I have postgres version 9.5 i want to execute PROGRAM clause of Postgres COPY command with Powershell command to import csv data into table

i try to execute following command in postgres 9.5 COPY [table name] FROM PROGRAM 'powershell -command { Get-Content "file path " | Select -skip 1}' WITH DELIMITER ',' CSV HEADER ;

Error:- DETAIL: child process exited with exit code 255

please help us thank you

Upvotes: 1

Views: 770

Answers (1)

Shubham
Shubham

Reputation: 33

Just i need to remove "{" "}" and it is working correctly Query is follow below COPY [table name] FROM PROGRAM 'powershell -command Get-Content "file path " | Select -skip 1' WITH DELIMITER ',' CSV HEADER ;

Upvotes: 0

Related Questions