BCP utility:“Copy direction must be either 'in', 'out' or 'format'”

杀马特。学长 韩版系。学妹 提交于 2019-12-10 17:19:55

问题


I get below mentioned error when I run BCP command for trusted connection:

Copy direction must be either 'in', 'out' or 'format'.

I tried searching MSDN, where it specifies that servername passed could be incorrect.

The command I am trying is:

bcp %SQL_database%..TABLE1 in \FileSERVER\file.dat -f\fileserver\Formats\file.fmt -eERR.txt -m1000000 -C -T RAW -S%SQL_server%

When I pass a username and password instead of using the -T option, it works. The command is executed from command prompt by passing parameters from command line.


回答1:


Your -C and -T options are flip-flopped - -C -T RAW instead of -C RAW -T.

Check the bcp utility's online documentation for confirmation that -C rather than -T should precede RAW.

Try this instead:

bcp %SQL_database%..TABLE1 in \FileSERVER\file.dat -f\fileserver\Formats\file.fmt -eERR.txt -m1000000 -C RAW -T -S%SQL_server%

My guess is that you probably misplaced the -T option when switching to a trusted connection (with the -T option) from integrated security (with the -U and -P options).



来源:https://stackoverflow.com/questions/22398282/bcp-utilitycopy-direction-must-be-either-in-out-or-format

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!