Import excel to sql server Executing Error (SSIS) - sql-server

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.

Related

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.

DTS Import failing

I have a spreadsheet. It contains company information such as name, address, phone, email, etc. All I want to do is a flat import into SQL into a table it can create so I can do some processing on it. I'm just using MS SQL Import Wizard. I'm not using BCP.
It gets all the way to the end and gives me this error:
Blockquote
Operation stopped...
Initializing Data Flow Task (Success)
Initializing Connections (Success)
Setting SQL Command (Success)
Setting Source Connection (Success)
Setting Destination Connection (Success)
Validating (Success)
Messages
Warning 0x80049304: Data Flow Task 1: Warning: Could not open global shared memory to communicate with performance DLL; data flow performance counters are not available. To resolve, run this package as an administrator, or on the system's console.
(SQL Server Import and Export Wizard)
Prepare for Execute (Success)
Pre-execute (Success)
Executing (Error)
Messages
Error 0xc020901c: Data Flow Task 1: There was an error with Source - crm_company$.Outputs[Excel Source Output].Columns[Directions] on Source - crm_company$.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 - crm_company$.Outputs[Excel Source Output].Columns[Directions]" failed because truncation occurred, and the truncation row disposition on "Source - crm_company$.Outputs[Excel Source Output].Columns[Directions]" specifies failure on truncation. A truncation error occurred on the specified object of the specified component.
(SQL Server Import and Export Wizard)
Copying to [dbo].[crm_company] (Stopped)
Messages
Error 0xc0047038: Data Flow Task 1: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on Source - crm_company$ 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)
Post-execute (Success)
Messages
Information 0x4004300b: Data Flow Task 1: "Destination - crm_company" wrote 469 rows.
(SQL Server Import and Export Wizard)
Blockquote
First of all, I have told DTS to ignore any truncation errors. The source fields are either int or nvarchar. I edit the mappings and force it to be int instead of float for the required columns. I have set the default column size to 510 from 255. For 2 columns, Directions and Notes, it has decided that the Directions is nvarchar and the Notes is nvarchar(max). I override the Directions one so that it is treated as nvarchar(max) and I can see that in the table it creates after it runs. However, when it runs it fails EVERY TIME with the above error.
I just want this data into a table. That's all. If I specify a table manually first and import, it still errors. The longest text in Directions is 978 characters long so it is hardly huge. I don't care if it truncates, I just don't want it to stop when it feels it needs to. There are 16000 rows importing and only 470 get imported before it fails.
I don't know which row fails it in the source file because strangely, DTS is not pulling the data in, in the order it is in, in the spreadsheet. Go figure. I tried overriding DTS's stupid attemtps at deciding what the column formats are by sticking 20 rows of text data in, but that still fails.
Suggestions:
If you have Visual Studio BI then develop a SSIS pack and:
1.) Try adding a branch for failed lines to redirect those. You can do that by adding a route with the red line from the excel source. After running the package, you can some analysis on the successful and failed lines.
2.) Important thing is what type of connection do you use for the SQL Server. I have a lot of issues with native SQL Client so I prefer to use ADO.NET or OLE DB connection types.
With the Wizard:
3.) Try to use type conversion
4.) Save the file to TXT then do the ETL.
I tried many things to get around this and found it alot easier to import the spreadsheet into Access and then import Access to SQL. Job done in 5 minutes.

How to import local flat tab file into new table within database using SQL Server 2012?

How do I import a local flat tab file into a database using SQL Server 2012 without truncation errors?
What I have tried: To import the local flat tab file into my database. I'm using Microsoft Sql Server Management System (MS SMS). I receive errors that the FULL_DESCRIPTION column is truncated. I changed the data type for that column to max and tried VARCHAR(max) & NVARCAR(max) & NTEXT(max) but I receive the same errors. I right click on the database > Tasks > Import Data.
Then the SQL server Import and Export Wizard appears.[Choose From Data Source.] > [Choose Data Destination to copy to.] > [Table Preview] > [Review Data Mapping] > Finish. It starts executing and I receive the following error screen.
Error 0xc02020a1: Data Flow Task 1: Data conversion failed. The data conversion for column "FULL_DESCRIPTION" returned status value 4 and status text "Text was truncated or one or more characters had no match in the target code page."
Error 0xc020902a: Data Flow Task 1: The "Source - NameOfTabularFlatFile.Outputs[Flat File Source Output].Columns[FULL_DESCRIPTION]" failed because truncation occurred, and the truncation row disposition on "Source - NameOfTabularFlatFile.Outputs[Flat File Source Output].Columns[FULL_DESCRIPTION]" specifies failure on truncation. A truncation error occurred on the specified object of the specified component.
Error 0xc0202092: Data Flow Task 1: An error occurred while processing file "C:\Users...\Desktop\NameOfTabularFlatFile" on data row 2.
Error 0xc0047038: Data Flow Task 1: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on Source - NameOfTabularFlatFile 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.
Here is the execution error.
What I researched. https://learn.microsoft.com/en-us/sql/integration-services/import-export-data/connect-to-a-flat-file-data-source-sql-server-import-and-export-wizard
I ended up transferring the flat file into an Excel file and importing it into the SSIS 2008 R2 database without loosing data.
I transferred the flat file into excel as Microsoft Excel 97-2003 Worksheet.
How to import an Excel file into SQL Server?

Error on Import Data Excel

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.

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