How to transfer data from a text file into the database - sql-server

I have data from sysssislog table in notepad (.txt) file, and I need to transfer data into the SQL server database.
I made table in sql server. Data should be to transfer in table using SSIS packages. During the work appeared to me this error.
Does anyone know how to solve it? Thanks a lot
[OLE DB Destination [113]] Error: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft SQL Server Native Client 11.0" Hresult: 0x80004005 Description: "Violation of PRIMARY KEY constraint 'PK__sysssisl__3213E83F530E2571'. Cannot insert duplicate key in object 'dbo.sysssislog'. The duplicate key value is (0).".
[OLE DB Destination [113]] Error: SSIS Error Code
DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "OLE DB Destination.Inputs[OLE DB Destination Input]" failed because error code 0xC020907B occurred, and the error row disposition on "OLE DB Destination.Inputs[OLE DB Destination Input]" specifies failure on error. An error occurred on the specified object of the specified component. There may be error messages posted before this with more information about the failure.
[SSIS.Pipeline] Error: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "OLE DB Destination" (113) failed with error code 0xC0209029 while processing input "OLE DB Destination Input" (126).
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.
[Flat File Source [56]] Error: The attempt to add a row to the Data Flow task buffer failed with error code 0xC0047020.
[SSIS.Pipeline] Error: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on Flat File Source which returns 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.

SSIS messages can be confusing at times because it looks like there are more errors than there really are. In this case, the first error is key: Violation of PRIMARY KEY constraint All of the others after it are letting you know there was at least one error preventing the task from completing.
Check your mapping and ensure that you're not entering duplicate values into whatever Primary Key you've set for the table.

You can Use BCP to Import your data into SQL Server database:
Here is a simple command for importing data from file:
C:\example.txt into table dbo.example.
bcp dbo.example in 'C:\example.txt' -T -SserverName\instanceName

Related

SSIS Package potential loss of data only in catalog

I have a package and in the Data Flow the Source Task selects data and one of the columns is ProcessingTime and is of type datetime2(7). After some checks and derived columns there is a Slowly Changing Dimension task. Which branch into 'Insert Destination' and 'Update Destination'
Now the problem is that when i run the package from a sql job I get flowing error:
Description = SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "Insert Destination" (11) failed with error code 0xC0209029 while processing input "OLE DB Destination Input" (24). 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.
Description = SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "Insert Destination.Inputs[OLE DB Destination Input]" failed because error code 0xC0209077 occurred, and the error row disposition on "Insert Destination.Inputs[OLE DB Destination Input]" specifies failure on error. An error occurred on the specified object of the specified component. There may be error messages posted before this with more information about the failure.
Description = There was an error with Insert Destination.Inputs[OLE DB Destination Input].Columns[ProcessingTime] on Insert Destination.Inputs[OLE DB Destination Input]. The column status returned was: "The value could not be converted because of a potential loss of data.".
Description = SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80040E21. An OLE DB record is available. Source: "Microsoft OLE DB Provider for SQL Server" Hresult: 0x80040E21 Description: "Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.".
And the bigger problem is this error does not occur in any Visual Studio or using 'Run Package...' in the catalog, only from the job.
I checked the type of the Source as the Insert Destination and both has the type DT_DBTIMESTAMP2 with scale 7.
I configured a custom 'If not exists then insert else update'-task but I'd like the native SCD task. Any suggestions? Version of SSIS is 13 (2016 version).

SSIS errors are coming while loading the dynamic excel into ssms table

I am trying to load excel into SSMS Tables dynamically. I am facing the below issues. i kept REASON field length as max for the data type of nvarchar(max).
I tried with nvarchar(4000), still receiving the same errors.
[Excel Source [12]] Error: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80040E21.
An OLE DB record is available. Source: "Microsoft Access Database Engine" Hresult: 0x80040E21 Description: "Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.".
[Excel Source [12]] Error: Failed to retrieve long data for column "REASON".
[Excel Source [12]] Error: There was an error with Excel Source.Outputs[Excel Source Output].Columns[REASON] on Excel Source.Outputs[Excel Source Output]. The column status returned was: "DBSTATUS_UNAVAILABLE".
[Excel Source [12]] Error: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "Excel Source.Outputs[Excel Source Output].Columns[REASON]" failed because error code 0xC0209071 occurred, and the error row disposition on "Excel Source.Outputs[Excel Source Output].Columns[REASON]" specifies failure on error. An error occurred on the specified object of the specified component. There may be error messages posted before this with more information about the failure.
[SSIS.Pipeline] Error: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on Excel Source returned error code 0xC0209029. 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.
I can't share the data here since it's client data. Please let me know on this will be appreciated.

Recieveing Errors on SQL Import Export wizard

I am trying to import data from an Excel file to an SQL database with the SQL Import Export wizard. We've had 4 sheets upload correctly and we are able to query them. For some reason though, a few of our tables are giving some errors and we aren't sure how to decipher them or what the problem could be, as they are very similar to the tables that have worked.
Here are the errors:
Copying to [dbo].[Products] (Error)
Messages
Error 0xc0202009: Data Flow Task 1: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft SQL Server Native Client 11.0" Hresult: 0x80004005 Description: "Unspecified error".
(SQL Server Import and Export Wizard)
Error 0xc020901c: Data Flow Task 1: There was an error with Destination - Products.Inputs[Destination Input].Columns[ProductID] on Destination - Products.Inputs[Destination Input]. The column status returned was: "The value violated the integrity constraints for the column.".
(SQL Server Import and Export Wizard)
Error 0xc0209029: Data Flow Task 1: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "Destination - Products.Inputs[Destination Input]" failed because error code 0xC020907D occurred, and the error row disposition on "Destination - Products.Inputs[Destination Input]" specifies failure on error. An error occurred on the specified object of the specified component. There may be error messages posted before this with more information about the failure.
(SQL Server Import and Export Wizard)
Error 0xc0047022: Data Flow Task 1: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "Destination - Products" (38) failed with error code 0xC0209029 while processing input "Destination Input" (51). 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)
What do these mean? And what could we need to do to fix them?
Thanks
we had similar issue. Since you have a column which can not be null, you need to remove empty rows.
Just select all rows after last record and remove it then save your excel sheet and try to upload again.
The error message "The value violated the integrity constraints for the column" indicates that it's trying to import data and it is violating a constraint on your ProductID column. It's likely that either there are null values for the column that are trying to go into a field that is not null-able, or adding the row would violate some foreign key constraints.

SSIS 2008 R2 Completes But Gives Error "Violation of PRIMARY KEY constraint"

I've found a number of links on this but so far not the one with an answer.
Issue: SSIS 2008 R2 package importing data from many tables (about 160) of SQL 2000 database (conversion project) into new structures. This has run cleanly a number of times. To be clear, the data appears to be actually importing correctly. However, the last 3 times, I've run into this error. The Task (54) Source (269) shown in the message below is the last step and item in the step.
I've confirmed that the table mention as a "duplicate key violation" actually has the same 49166 records as the source. It seems like it almost just has issue with threading or the time that has elapsed (long running query). I have TRUNCATED the 5 tables in the final step and re-run that single Task 54 and it completes just fine, all green.
It would be good to not have to go hunting through the process due to red herrings. Any idea on how to address this so it reports cleanly?
Thanks
Error message below:
Executed as user: [masked]. Microsoft (R) SQL Server Execute Package Utility Version 10.50.6000.34 for 64-bit Copyright (C) Microsoft Corporation 2010. All rights reserved. Started: 4:36:46 PM Error: 2015-05-20 16:36:48.49 Code: 0xC0016016 Source: Description: Failed to decrypt protected XML node "DTS:Password" with error 0x8009000B "Key not valid for use in specified state.". You may not be authorized to access this information. This error occurs when there is a cryptographic error. Verify that the correct key is available. End Error Error: 2015-05-20 16:36:48.50 Code: 0xC0016016 Source: Description: Failed to decrypt protected XML node "DTS:Password" with error 0x8009000B "Key not valid for use in specified state.". You may not be authorized to access this information. This error occurs when there is a cryptographic error. Verify that the correct key is available. End Error Error: 2015-05-20 17:19:33.78 Code: 0xC0202009 Source: Data Flow Task 54 Destination 269 - cadNotificationStatus [396] Description: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80004005 Description: "The statement has been terminated.". An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80004005 Description: "Violation of PRIMARY KEY constraint 'PK__cadNotif__25843E4F1B0907CE'. Cannot insert duplicate key in object 'dbo.cadNotificationStatus'. The duplicate key value is (4, 2).". End Error Error: 2015-05-20 17:19:33.79 Code: 0xC0209029 Source: Data Flow Task 54 Destination 269 - cadNotificationStatus [396] Description: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "input "OLE DB Destination Input" (409)" failed because error code 0xC020907B occurred, and the error row disposition on "input "OLE DB Destination Input" (409)" specifies failure on error. An error occurred on the specified object of the specified component. There may be error messages posted before this with more information about the failure. End Error Error: 2015-05-20 17:19:33.79 Code: 0xC0047022 Source: Data Flow Task 54 SSIS.Pipeline Description: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "Destination 269 - cadNotificationStatus" (396) failed with error code 0xC0209029 while processing input "OLE DB Destination Input" (409). 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. End Error Error: 2015-05-20 17:19:33.81 Code: 0xC02020C4 Source: Data Flow Task 54 Source 269 - cadNotificationStatus [218] Description: The attempt to add a row to the Data Flow task buffer failed with error code 0xC0047020. End Error Error: 2015-05-20 17:19:33.81 Code: 0xC0047038 Source: Data Flow Task 54 SSIS.Pipeline Description: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on component "Source 269 - cadNotificationStatus" (218) 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. End Error DTExec: The package execution returned DTSER_FAILURE (1). Started: 4:36:46 PM Finished: 5:19:34 PM Elapsed: 2568.01 seconds. The package execution failed. The step failed.
As per the error, it is failing while to inserting duplicate records in 'dbo.cadNotificationStatus' table. Is there any logic to import only new records from source table which is in SQL 2000, which are not present in destination table? If no, data flow task importing data into this table is going to fail.
It looks like, it is running successfully because you are truncating the table and then importing the whole data again. If you can provide more info regarding source query, it will be more clear.
Just to be 100% sure I would redirect rows to a flat file that are causing you the issue. This will allow you to see what line item is causing the failure or triggering the error message. This link shows a good tutorial of how to do that:
http://www.techbrothersit.com/2013/07/ssis-how-to-redirect-invalid-rows-from.html
Also it looks like you have more going on in your error output from a security perspective based on the below:
Description: Failed to decrypt protected XML node "DTS:Password" with error 0x8009000B "Key not valid for use in specified state.". You may not be authorized to access this information.
My guess is that someone else created this package and used: "EncryptSensitiveWithUserKey"...
I would recommend:
While importing the package to SQL Server choose Protection Level: Either
1- Don't save sensitive data.
Or
2- Rely on Server Storage and roles for access control.

what is Unspecified error in ssis

The ssis package consists of OLED source and OLEDB destination.Extract data from a sql 2000 server source db and load it into same database target database table.while loading 4 million rows,got error after 3 million rows..
it took 4 hours to load these many records using ssis...
please see the below error
[Ae_Data [737]] Error: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80004005 Description: "Unspecified error".
[Ae_Data [737]] Error: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "input "OLE DB Destination Input" (750)" failed because error code 0xC020907B occurred, and the error row disposition on "input "OLE DB Destination Input" (750)" specifies failure on error. An error occurred on the specified object of the specified component. There may be error messages posted before this with more information about the failure.
try changing it to a ADO.NET Destination
I had a similar issue today and non of the internet posts worked for me. The error I was getting to is similar to yours. I'm posting in case someone else has the same problem
Error: 0xC0202009 at Get fresh data, OLE DB Destination [2]: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft SQL Server Native Client 11.0" Hresult: 0x80004005 Description: "Unspecified error".
Error: 0xC0209029 at Get fresh data, OLE DB Destination [2]: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "OLE DB Destination.Inputs[OLE DB Destination Input]" failed because error code 0xC020907B occurred, and the error row disposition on "OLE DB Destination.Inputs[OLE DB Destination Input]" specifies failure on error. An error occurred on the specified object of the specified component. There may be error messages posted before this with more information about the failure.
Error: 0xC0047022 at Get fresh data, SSIS.Pipeline: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "OLE DB Destination" (2) failed with error code 0xC0209029 while processing input "OLE DB Destination Input" (15). 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.
This was happening when doing an OLE DB transfer from one table to another. The problem was with the destination's table index
Tried to drill down on a particular record that was giving the problem and identified which fields were giving the problems. I managed to do through a number of trial and errors. By amending the source sql query to select different fields, until I found out which field(s) were giving me the insert problems.
Then deleted any associated indexes on that particular destination and it worked

Resources