Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在批处理命令文件中有一个 BCP 操作。当 BCP 操作出现错误时,我需要停止处理并将 err msg 写入日志文件
我曾经-e选择在 BCP 操作期间将错误消息写入 err 文件。错误文件正在该位置创建,但不包含任何写入其中的错误消息。
-e
我的 BCP 声明是这样的。
BCP DbName.dbo.tableName In FileLocation -e Errorfile -S ServerName -T -c
有没有办法获得错误级别然后停止处理?
感谢快速帮助。
-m 参数指定最大错误。“bcp 实用程序无法复制的行将被忽略并计为一个错误。如果不包括此选项,则默认值为 10。”
-e 参数指定存储数据的文件,bcp 无法写入输出文件。
bcp 实用程序正在向 DOS 环境报告错误。从 DOS 脚本运行 bcp 并从 DOS 环境中捕获/写入错误。