Forum Discussion
Importing excel data in SQL Server
- Sep 15, 2023
"Text was truncated or one or more characters had no match in the target code page.".
As I already wrote, source text to long or you try to import Unicode (nvarchar) into a varchar column.
Check source + target data types & max length.
Shiny_Felicita , next time please post the error message as text, not as a screenshot; it's hard to see anything in that small image.
I see "truncation" and that means you try to import larger data into a table column then defined by the target column, e.g. 255 characters (default for Excel) into a column of varchar(50); that's not possible.
So check the data sizes is source and destination.
- Shiny_FelicitaSep 15, 2023Copper ContributorThanks for your suggestion. The below mentioned is the error description of the attached screenshot.
- Executing (Error)
Messages
Error 0xc020901c: Data Flow Task 1: There was an error with Source - Report1690184236624$.Outputs[Excel Source Output].Columns[Resolution] on Source - Report1690184236624$.Outputs[Excel Source Output]. The column status returned was: "Text was truncated or one or more characters had no match in the target code page.".
(SQL Server Import and Export Wizard)
Error 0xc020902a: Data Flow Task 1: The "Source - Report1690184236624$.Outputs[Excel Source Output].Columns[Resolution]" failed because truncation occurred, and the truncation row disposition on "Source - Report1690184236624$.Outputs[Excel Source Output].Columns[Resolution]" specifies failure on truncation. A truncation error occurred on the specified object of the specified component.
(SQL Server Import and Export Wizard)
Error 0xc0047038: Data Flow Task 1: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on Source - Report1690184236624$ returned error code 0xC020902A. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing. There may be error messages posted before this with more information about the failure.
(SQL Server Import and Export Wizard)- olafhelperSep 15, 2023Bronze Contributor
"Text was truncated or one or more characters had no match in the target code page.".
As I already wrote, source text to long or you try to import Unicode (nvarchar) into a varchar column.
Check source + target data types & max length.
- indranil1992Mar 14, 2024Copper Contributor
I tried to import excel data into sql. After multiple attempts the data was imported but some total columns are showing only null values. Those total columns do not have any formulas in it. I am facing this issue while importing CSV also. After importing data from CSV all the columns are showing data type varchar(50), and when I'm trying to cast the column in DATE or INT or FLOAT format the below error is showing
Msg 241, Level 16, State 1, Line 5
Conversion failed when converting date and/or time from character string.What should I do