Is it possible to load a subset of columns using Sybase 15 bcp?
-
29-10-2019 - |
Question
I have a CSV file with 20 or so columns and I want to load it into a table with only 9 columns - I want to throw away the rest.
Can I do it directly with bcp or do I need to preprocess the file to strip it down to just what I need?
The manual does not seem to detail it.
But then I seem to have options that arent in the manual, eg -labeled ?
Thanks in advance, Chris
Solution
No, this isn't possible with bcp.
OTHER TIPS
You can combine pipes, awk and bcp. F.e.
In the first shell:
mknod bcp.pipe p
cat > awk > bcp.pipe
in the second shell:
bcp db..table in bcp.pipe -c -U ...
You could create a view on the table which only includes the columns you want. Then bcp out the view instead of the table.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow