Copy command using filter
Hi,
I have a requirement where i need to restrict the data in copy command. suppose i hve 1000 records in my csv file that i will be loadinh using copy command, so i want that with this copy command i can load the data like top 500 from bottom.
That is from 500 to 1000.
Now if my record got increased by 50 that is total 1050 record the 550 record to be populated.
Is their any solution for this????
0
Comments
If requirement is only to skip top 500 records everytime , You can use SKIP with copy command , it will skip top 500 records always means 1 -500 .
copy abc from /temp/abc.txt delimiter ';' SKIP 500 ;
--> above command will skip top 500 records .
copy abc from /temp/abc.txt delimiter ';' SKIP bytes 500 ;
--> This command will skip 500 bytes from starting of file.
Thanks :
Abhi
You can do this using pipes in linux and the stdin copy option.
- just pipe the output of the tail or any linux command that can limit the numbers of rows, form head or tail to your copy command.
- you can put more logic in linux scripting then in the copy command.
See example:
not sure i understand your requirment !