When EXCEL data is imported into SQL, a text truncation error occurs, and the returned column status is: "The text is truncated, or one or more characters have no match in the target code page" solution

In the past, it was very simple to import data with the SQL import wizard, and the operation was done step by step. However, this error was reported today. First, sort out the various solutions found on the Internet:

1. Save the excel file as a .csv file, and then use the flat source file to import. During this period, you can also modify the encoding method of the csv file field, such as changing the Chinese to Unicode encoding.

2. The characters in the source field are too long, and the field length of the target table needs to be modified, such as changing nvarchar(50) to nvarchar(max).

3. Modify the value of the TypeGuessRows item in the registry and set it to, I am WIN10 SQL2012, the location of this item:

           Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Jet\4.0\Engines\Excel.

 4. It may be determined by the type and length of the column based on the data volume of the first 8 rows when SQL reads the excel file. So you can try to assign larger values ​​to the columns of the first row, and then re-import to see the effect.

----------------------------------------- However, I have tried all these, and there is no egg use----------------------------------------------

So try to find errors in the original data to see if there is dirty data, or abnormal characters lead to data import errors (however, the data is very simple, and there is no abnormal phenomenon).

Then I changed to check the format of the excel data and found that the format is a bit strange, for example, the custom format of long date type data is yyyy/mm/dd; @ then changed it to yyyy/m/d. And change all the text in the original data to text type, all the dates are in custom format, and remove very strange characters.

Reimport.

Import was successful.

 

Guess you like

Origin blog.csdn.net/icefountain/article/details/83088616