Error on Import Data Excel - sql-server

I use SQL Server Import and Export Wizard for import data from an excel sheet.
And these are the errors:
Messages Error 0xc020901c: Data Flow Task 1: There was an error with
Source - Sheet1$.Outputs[Excel Source Output].Columns[PtnDescription]
on Source - Sheet1$.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 -
Sheet1$.Outputs[Excel Source Output].Columns[PtnDescription]" failed
because truncation occurred, and the truncation row disposition on
"Source - Sheet1$.Outputs[Excel Source
Output].Columns[PtnDescription]" 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 - Sheet1$ 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.
And the columns thta I have enter image description here
What can I do?

That means there are unicode characters in your Excel source data that cannot be converted to the the target column(s) in SQL Server [varchar() or char()]. In SQL Server you need to use nvarchar() or char() columns to store unicode data you want to import from Excel.
The import wizard is throwing an error and letting you know (albeit mystically) that is the problem.
UPDATE: Disregard this, Panagotis is correct, you have need to widen your target, not change the data type. Sorry for the confusion.

Related

Error importing CSV in SQL Server for 1 Specific File All Others Work fine

I have downloaded files from the website below:
https://www.kaggle.com/competitions/nfl-big-data-bowl-2022/data
I've imported games.csv, players.csv, and PFFScoutingData.csv.
However, when I go to import plays.csv using SQL Server's Import & Export Wizard I'm getting errors that I have been trying to resolve by changing data types and I cannot figure it out.
Data Source: Flat File Source
File Name: plays.csv
Locale: English
Unicode: Not Checked
Code Page: 1252 (ANSI - Latin I)
Format: Delimited
Text Qualifier: none
Header row delimiter: CR/LF
Header rows to skip: 0
Column Names in first data row is checked
I then click next and leave everything as default on the new screen.
Destination: Microsoft OLE DB Provider for SQL Server
I then click next, and then next again on the next page.
I click finish twice and then I get this error.
Executing (Error)
Messages
Error 0xc02020a1: Data Flow Task 1: Data conversion failed. The data conversion for column ""quarter"" returned status value 4 and status text "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 - plays_csv.Outputs[Flat File Source Output].Columns["quarter"]" failed because truncation occurred, and the truncation row disposition on "Source - plays_csv.Outputs[Flat File Source Output].Columns["quarter"]" specifies failure on truncation. A truncation error occurred on the specified object of the specified component.
(SQL Server Import and Export Wizard)
Error 0xc0202092: Data Flow Task 1: An error occurred while processing file "C:\Users\Owner\Desktop\nflcomp\plays.csv" on data row 3.
(SQL Server Import and Export Wizard)
Error 0xc0047038: Data Flow Task 1: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on Source - plays_csv returned error code 0xC0202092. 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)

Import excel to sql server Executing Error (SSIS)

I was trying to import excel file to sql server for the first time and I get this error. Could you please help me? No idea what's going on :|
Operation stopped...
Initializing Data Flow Task (Success)
Initializing Connections (Success)
Setting SQL Command (Success)
Setting Source Connection (Success)
Setting Destination Connection (Success)
Validating (Success)
Prepare for Execute (Success)
Pre-execute (Success)
Executing (Error) Messages
Messages
Error 0xc020901c: Data Flow Task 1: There was an error with Source - Sheet1$.Outputs[Excel Source
Output].Columns[Threat] on Source - Sheet1$.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 - Sheet1$.Outputs[Excel Source Output].Columns[Threat]" failed
because truncation occurred, and the truncation row disposition on
"Source - Sheet1$.Outputs[Excel Source Output].Columns[Threat]"
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 - Sheet1$
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)
Copying to [dbo].[Sheet1$] (Stopped)
Post-execute (Success) Messages Information 0x4004300b: Data Flow Task 1: "Destination - Sheet1$" wrote 0 rows. (SQL Server Import and
Export Wizard)
The data which you are importing might be having text bigger than columns size of table.
Maximize the size of the table column and then try.
Check the length for the column Threat on source and destination. Please adjust that according to the length on excel, bascally increase it.
Alternatively, In the Excel source editor and click on error output tab.
Select the column Threat and in Truncation column set the value as Ignore failure.
This should help.
Check out the ideas in this Stackoverflow link enter link description here, then. It might be trying to import some extra blank rows, which you can either allow (by changing the ALLOW NULLS option), or pipe the failed rows into a different dataset in SSIS, to handle the failing rows separately
Are you creating a DFT manually? If so:
1) Create New Excel Connection Manager - Link your excel file
2) Create New OLE DB Connection Manager - Choose your Database and Table.
3) Excel Source
4) Data Conversion - Convert the EXCEL column to DT_STR which makes it Varchar instead of NVARCHAR.
5) OLE DB Destination which is your SQL server table.
Alternatively you could set the column to NVARCHAR and it would match the EXCEL But if it's a VARCHAR column the data needs to be converted to DT_STR in the data conversion. Let me know if you need more help.

Import Large Cities Text File into SQL server

I'm trying to import Text file for cities name into SQL server 2012. The file is 1.45 GB, I'm using SQL Server Import and Export Wizard to do the job but each time I get this error:
Copying to [dbo].[worldcitiespop] (Error)
Messages
Error 0xc02020a1: Data Flow Task 1: Data conversion failed. The data conversion for column "City" returned status value 4 and status text "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 - worldcitiespop_txt.Outputs[Flat File Source Output].Columns[City]" failed because truncation occurred, and the truncation row disposition on "Source - worldcitiespop_txt.Outputs[Flat File Source Output].Columns[City]" specifies failure on truncation. A truncation error occurred on the specified object of the specified component.
(SQL Server Import and Export Wizard)
Error 0xc0202092: Data Flow Task 1: An error occurred while processing file "C:\Users\elsho\Downloads\worldcitiespop.txt\worldcitiespop.txt" on data row 114091.
(SQL Server Import and Export Wizard)
Error 0xc0047038: Data Flow Task 1: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on Source - worldcitiespop_txt returned error code 0xC0202092. 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)
I changed the Table fields size to the text type to avoid data length problem but this did not help,please advise.
Thanks
I strongly recommend that you use a staging table. Import the table into a staging table with wide nvarchar() text fields.
If you cannot do this successfully, then the data file itself is probably corrupted.
After you have loaded into the staging table, insert the data (with appropriate conversions) into the final form (and then build indexes). It is much easier to find such problems when the data is already in a table than when trying to import it frustratingly over and over again.

SQL Server Export Wizard Error

I'm hoping someone can help me. I have a big query, like 2 million records. It has some exotic characters, and I think some of the values have commas which is making it difficult to export the query results to a flat file and then import them into another table in a different server and database.
I've been trying to use the export wizard so I can change the column delimiter to tab, but I'm getting the errors below I think because of the exotic characters and merged values.
Any tips are greatly appreciated.
Errors:
Error 0xc02020a1: Data Flow Task 1: Data conversion failed. The data conversion for column "ACCOUNT_NM" returned status value 4 and status text "Text was truncated or one or more characters had no match in the target code page.".
(SQL Server Import and Export Wizard)
Error 0xc02020a0: Data Flow Task 1: Cannot copy or convert flat file data for column "ACCOUNT_NM".
(SQL Server Import and Export Wizard)
Error 0xc0047022: Data Flow Task 1: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "Destination - TestExport_txt" (172) failed with error code 0xC02020A0 while processing input "Flat File Destination Input" (173). The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running. There may be error messages posted before this with more information about the failure.
(SQL Server Import and Export Wizard)
Error 0xc02020c4: Data Flow Task 1: The attempt to add a row to the Data Flow task buffer failed with error code 0xC0047020.
(SQL Server Import and Export Wizard)
Error 0xc0047038: Data Flow Task 1: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on component "Source - Query" (1) returned error code 0xC02020C4. 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)
The truncation error essentially means there is something wrong with your metadata either in your source or destination. You can set the column to "ignore truncation error" and test to see if your data is still accurate...if not then you will need to check your metadata and make the relevant change.
In Import Export wizard, while configuring Destination, try using Code Page to UTF-8, Text qualifier as " and choose column delimiter as of your choice. Also try with and without checking Unicode option. While editing mappings, select data type and size accordingly source. Most of time DT_TEXT or DT_NTEXT will work for all columns.
You can this resource helpful for SSIS data type mappings - SSIS Data Type Mapping

Postgresql to Sql Server 2008 Table Transfer

I'm using postgresql (Pgadmin Version 1.18.0), i export three(I need only 3 tables) table(Contains Online Transaction information) data's into csv format using the query
copy to 'D:\orders\new\users.csv' DELIMITER ';' CSV HEADER
I got perfect result using the query. Now i open the ssms(Sql Server 2008) and using the Import and Export data option i import the users.csv file to sql server 2012 by using "Flat File Service Data Source". at last while i click the Finish Button it throws the following error Messages
--Error 0xc02020a1: Data Flow Task 1: Data conversion failed. The data conversion for
column "address" returned status value 4 and status text "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 - users_csv.Outputs[Flat File Source
Output].Columns[address]" failed because truncation occurred, and the truncation row
disposition on "Source - users_csv.Outputs[Flat File Source Output].Columns[address]"
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 - users_csv returned error code 0xC0202092. 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)
Please help me out. Sorry if it's vague.
Thanks in Anticipation.
Regards,
Keerthi
Your data's size exceeds the field size. Extend the size of your address field in the target table. If you still get the error, check the "Advanced" Option in the Import and Export Wizard. You can set the OutputColumnWidth for each column there.

Resources