开发者

Is it possible to load a subset of columns using Sybase 15 bcp?

开发者 https://www.devze.com 2023-03-03 05:50 出处:网络
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.

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 tha开发者_运维知识库t 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消