SQL Server Bulk Insert conversion error MSG 4864 HRESULT 0x80004005
<p>This is my first question here (I have been lurking and learning a lot in the past few years).</p>

<p>I have a problem with Bulk Insert in SQL Server 2012, it returns errors.</p>

<p>Bulk Insert code:</p>

<pre><code>--DROP TABLE dbname.logg20160203
BULK INSERT dbname.logg20160204 
FROM 'x:\xxxx\SYSTEMID\log20151005t.ms'
WITH 
(
       FIRSTROW = 1,
       ORDER (Id),
       CODEPAGE = 'RAW',
       --DATAFILETYPE = 'char',
       FIELDTERMINATOR = '|',
       --ROWTERMINATOR = '\n',
       --ROWTERMINATOR = '\r',
       --ROWTERMINATOR = '\n\r',
       --ROWTERMINATOR = '\r\n',
       ROWTERMINATOR = '0x0a',
       TABLOCK, --Performance
       ERRORFILE = 'x:\xxxx\SYSTEMID\err104.log',
       FORMATFILE = 'x:\xxxx\SYSTEMID\formatfile-n.fmt',
       KEEPNULLS
);
</code></pre>

<p>Errors returned:</p>

<blockquote>
  <p>Msg 4864, Level 16, State 1, Line 2<br>
  Bulk load data conversion error (type mismatch or invalid character
  for the specified codepage) for row 2, column 1 (TStamp).</p>
</blockquote>

<p>Here is the data specified in the message: </p>

<pre><code>    2|yyyy-mm-dd hh:mm:ss|||GTM|||cccccccc||||||
</code></pre>

<p>My format file (so that we can keep Swedish letters in the data)</p>

<pre><code>    11.0
    14
    1       SQLCHAR             0       0       ""   1     col1               ""
    2       SQLCHAR             0       19      "\r\n"   2    col2        ""
    3       SQLCHAR             0       20      ""   3     col3              Finnish_Swedish_CI_AS
    4       SQLCHAR             0       5       ""   4     col4             Finnish_Swedish_CI_AS
    5       SQLCHAR             0       10      ""   5     col5              Finnish_Swedish_CI_AS
    6       SQLCHAR             0       20      ""   6     col6           Finnish_Swedish_CI_AS
    7       SQLCHAR             0       20      ""   7     col7            Finnish_Swedish_CI_AS
    8       SQLCHAR             0       100     ""   8     col8             Finnish_Swedish_CI_AS
    9       SQLCHAR             0       10      ""   9     col9           Finnish_Swedish_CI_AS
    10      SQLCHAR             0       20      ""   10    col10            Finnish_Swedish_CI_AS
    11      SQLCHAR             0       20      ""   11    col11              Finnish_Swedish_CI_AS
    12      SQLCHAR             0       20      ""   12    col12              Finnish_Swedish_CI_AS
    13      SQLCHAR             0       20      ""   13    col13              Finnish_Swedish_CI_AS
    14      SQLCHAR             0       20      ""   14    col14           Finnish_Swedish_CI_AS
</code></pre>

<p>err104.log</p>

<pre><code>    Row 2 File Offset 331 ErrorFile Offset 0 - HRESULT 0x80004005
    Row 3 File Offset 637 ErrorFile Offset 306 - HRESULT 0x80004005
    Row 4 File Offset 978 ErrorFile Offset 647 - HRESULT 0x80004005
    Row 5 File Offset 1278 ErrorFile Offset 947 - HRESULT 0x80004005
    Row 6 File Offset 1627 ErrorFile Offset 1296 - HRESULT 0x80004005
    Row 7 File Offset 1946 ErrorFile Offset 1615 - HRESULT 0x80004005
    Row 8 File Offset 2300 ErrorFile Offset 1969 - HRESULT 0x80004005
    Row 9 File Offset 2597 ErrorFile Offset 2266 - HRESULT 0x80004005
    Row 10 File Offset 2940 ErrorFile Offset 2609 - HRESULT 0x80004005
    Row 11 File Offset 3261 ErrorFile Offset 2930 - HRESULT 0x80004005
    Row 12 File Offset 3564 ErrorFile Offset 3233 - HRESULT 0x80004005
</code></pre>

<p>Thanks in advance! If you have any comments on the question itself or if you need any details please don't hesitate to ask.</p>