将此BCP命令用于格式文件 -
bcp DataBaseTablePath format nul -c -t, -r "0x0a" -f formatfilepath -S serveraddress -U username -P password
由于我已指定 -c 选项, 使用字符数据类型执行操作。
问题 - 从csv文件加载数据,该文件具有像
这样的列数据02:38:22
这需要存储在我的数据库中时间数据类型。
但我收到了以下错误 -
Exception Msg : SQLState = 22005, NativeError = 0Error = [Microsoft][SQL Server Native Client 11.0]Invalid character value for cast specificationSQLState = 22005, NativeError = 0Error = [Microsoft][SQL Server Native Client 11.0]Invalid character value for cast specificationSQLState = 22005, NativeError = 0Error = [Microsoft][SQL Server Native Client 11.0]Invalid character value for cast specificationSQLState = 22005, NativeError = 0Error = [Microsoft][SQL Server Native Client 11.0]Invalid character value for cast specificationSQLState = 22005, NativeError = 0Error = [Microsoft][SQL Server Native Client 11.0]Invalid character value for cast specificationSQLState = 22005, NativeError = 0Error = [Microsoft][SQL Server Native Client 11.0]Invalid character value for cast specificationSQLState = 22005, NativeError = 0Error = [Microsoft][SQL Server Native Client 11.0]Invalid character value for cast specificationSQLState = 22005, NativeError = 0Error = [Microsoft][SQL Server Native Client 11.0]Invalid character value for cast specificationSQLState = 22005, NativeError = 0Error = [Microsoft][SQL Server Native Client 11.0]Invalid character value for cast specificationSQLState = 22005, NativeError = 0Error = [Microsoft][SQL Server Native Client 11.0]Invalid character value for cast specificationBCP copy in failed
但是当我尝试从csv删除时间列数据后加载数据时,它的加载成功。
无法理解导致问题的原因是什么?