ma-100140 @ ウィキ

bcp

最終更新:

ma-100140

- view
管理者のみ編集可

I/O error while reading BCP format file というエラーが出る

色々調べたらありました http://luke.breuer.com/time/item/bcp_utility_gotchas/46.aspx

  • I/O error while reading BCP format file

    format files must end with a newline

    何だファイルの最後は改行しなさいってことか...

    思いっきり2時間ほど悩んだ

  • コーテーションで囲ったCSVファイルをつくりたい
    bcp "select null as a1,設置先コード,設置先コード as nk,MAX(要求日) from 設置先テーブル要求用 group by 設置先コード;" queryout "D:\xx\xx\uketukejou\system\data\kekka.txt" -Sサーバー名\xxx -Uuserid -Puserpass -f D:\xx\xx\uketukejou\system\kekkaBCP.fmt
    
  • kekkaBCP.fmtの中身
    8.0
    4
    1 SYBCHAR 0 0 "'" 1 A1 ""
    2 SYBCHAR 0 8 "','" 2 Settic ""
    3 SYBCHAR 0 8 "','" 3 Nk ""
    4 SYBCHAR 0 23 "'\r\n" 4 Youkyubi ""
    ←最後の行に何もない1行が必要みたい
    
目安箱バナー