0
votes

I am trying to import data into a table through bcp command line utility. Earlier the error i was facing was of right truncation, i changed the data types in both my tables as nvarchar and ran the FMT command using the -n switch, now the error seems to have changed but i still cant import the data.

The command i use to import is as follows:

bcp ABC.ABC.DIM_Sales_Channel in C:\temp\datafile\DIM_Sales_Channel.dat -f C:\temp\formatcorrected\DIM_Sales_Channel.fmt -T

The error shown is as follows:

[Microsoft][SQL Server Native Client 11.0][SQL Server]Conversion not allowed from the given field type 0x38 for field 8 to column 8.




11.0
9
1       SQLINT              0       4       ""   1     Sales_Channel_SK                               ""
2       SQLINT              0       4       ""   2     Sales_Channel_ID                               ""
3       SQLNCHAR            2       36      ""   3     Sales_Channel_Code                             Latin1_General_CI_AI
4       SQLNCHAR            2       36      ""   4     Sales_Channel_Level_1                          Latin1_General_CI_AI
5       SQLNCHAR            2       36      ""   5     Sales_Channel_Level_2                          Latin1_General_CI_AI
6       SQLDATETIME         1       8       ""   6     Inserted_Date                                  ""
7       SQLDATETIME         1       8       ""   7     Modified_Date                                  ""
8       SQLINT              1       4       ""   8     batchno                                        ""
9       SQLINT              1       4       ""   9     Status                                         ""

[Microsoft][SQL Server Native Client 11.0][SQL Server]Conversion not allowed from the given field type 0x38 for field 8 to column 8.

Any clues?

1

1 Answers

0
votes

This error occurs when the columns in your FMT file mismatch with your destination table/Source tables, i had created an intermediate staging table for moving my data correctly and that was causing the issue here. It was resolved by taking the fmt file of my intermediate staging table.