문제

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

도움이 되었습니까?

해결책

No, this isn't possible with bcp.

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top