背景: 試圖通過批量插入將平面文件源中的數據批量插入到數據庫中。給以下。大容量插入錯誤的SQL存儲過程MSG 241
錯誤
Msg 241, Level 16, State 1, Line 2
Conversion failed when converting date and/or time from character string.
例行從數據:
2016-01-14 00:00:00 GTM clocktic
格式文件(.XML)
<?xml version="1.0"?>
<BCPFORMAT xmlns="http://schemas.microsoft.com/sqlserver/2004/bulkload/format" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<RECORD>
<FIELD ID="1" xsi:type="CharTerm" TERMINATOR="\t" MAX_LENGTH="20"/>
<FIELD ID="2" xsi:type="CharTerm" TERMINATOR="\t" MAX_LENGTH="#" COLLATION="Finnish_Swedish_CI_AS"/>
<FIELD ID="3" xsi:type="CharTerm" TERMINATOR="\t" MAX_LENGTH="#" COLLATION="Finnish_Swedish_CI_AS"/>
<FIELD ID="4" xsi:type="CharTerm" TERMINATOR="\t" MAX_LENGTH="#" COLLATION="Finnish_Swedish_CI_AS"/>
<FIELD ID="5" xsi:type="CharTerm" TERMINATOR="\t" MAX_LENGTH="#" COLLATION="Finnish_Swedish_CI_AS"/>
<FIELD ID="6" xsi:type="CharTerm" TERMINATOR="\t" MAX_LENGTH="#" COLLATION="Finnish_Swedish_CI_AS"/>
<FIELD ID="7" xsi:type="CharTerm" TERMINATOR="\t" MAX_LEN GTH="#" COLLATION="Finnish_Swedish_CI_AS"/>
<FIELD ID="8" xsi:type="CharTerm" TERMINATOR="\t" MAX_LENGTH="#" COLLATION="Finnish_Swedish_CI_AS"/>
<FIELD ID="9" xsi:type="CharTerm" TERMINATOR="\t" MAX_LENGTH="#" COLLATION="Finnish_Swedish_CI_AS"/>
<FIELD ID="10" xsi:type="CharTerm" TERMINATOR="\t" MAX_LENGTH="#" COLLATION="Finnish_Swedish_CI_AS"/>
<FIELD ID="11" xsi:type="CharTerm" TERMINATOR="\t" MAX_LENGTH="#" COLLATION="Finnish_Swedish_CI_AS"/>
<FIELD ID="12" xsi:type="CharTerm" TERMINATOR="\t" MAX_LENGTH="#" COLLATION="Finnish_Swedish_CI_AS"/>
<FIELD ID="13" xsi:type="CharTerm" TERMINATOR="\n" MAX_LENGTH="#" COLLATION="Finnish_Swedish_CI_AS"/>
</RECORD>
<ROW>
<COLUMN SOURCE="1" NAME="TStamp" xsi:type="SQLDATETIME"/>
<COLUMN SOURCE="2" NAME="var2" xsi:type="SQLVARYCHAR"/>
<COLUMN SOURCE="3" NAME="var3" xsi:type="SQLVARYCHAR"/>
<COLUMN SOURCE="4" NAME="var4" xsi:type="SQLVARYCHAR"/>
<COLUMN SOURCE="5" NAME="var5" xsi:type="SQLVARYCHAR"/>
<COLUMN SOURCE="6" NAME="var6" xsi:type="SQLVARYCHAR"/>
<COLUMN SOURCE="7" NAME="var7" xsi:type="SQLVARYCHAR"/>
<COLUMN SOURCE="8" NAME="var8" xsi:type="SQLVARYCHAR"/>
<COLUMN SOURCE="9" NAME="var9" xsi:type="SQLVARYCHAR"/>
<COLUMN SOURCE="10" NAME="var10" xsi:type="SQLVARYCHAR"/>
<COLUMN SOURCE="11" NAME="var11" xsi:type="SQLVARYCHAR"/>
<COLUMN SOURCE="12" NAME="var12" xsi:type="SQLVARYCHAR"/>
<COLUMN SOURCE="13" NAME="var13" xsi:type="SQLVARYCHAR"/>
</ROW>
</BCPFORMAT>
引用此:http://stackoverflow.com/questions/14119133/conversion-failed-when-converting-date-and-or-time-from-character-string-while-i – TheGameiswar