Violation of Primary Key Constraint; SQL Server Express - sql

First, I am using SQL Server 2014 Express.
Second, I am using the SQL Server 2014 Import and Export Wizard.
I have imported a few items successfully using this same program. This is the exact error:
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: "The statement has been terminated.".
An OLE DB record is available.
Source: "Microsoft SQL Server Native Client 11.0"
Hresult: 0x80004005
Description: "Violation of PRIMARY KEY constraint 'PK_GEOG'. Cannot insert duplicate key in object 'dbo.geog'. The duplicate key value is (00, 06, 000001).".
(SQL Server Import and Export Wizard)
This is coming from a flat file source. I have imported this into excel and access and ran various tests. There is no other row in the database that contains (00, 06, 000001) in the first three columns.
These columns make up the primary key (state, type, area). I am no expert but I was not able to find a trigger connected to this table (GEOG).

Related

SSIS stopped working when loading into azure dwh

Hope someone can help here.
my SSIS packages (straightforward fetch rows from Azure SQL db ---> load into azure dwh) have suddenly stopped working, after running smoothly for 2 months.
The insert (specilifally OLE DB component) now fails with error message
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: "The source and target columns must be in the same order in the INSERT BULK statement."
Packages are developed with SSDT for VS 2013. No recoding or redeployment of azure dwh , just this error appeared out of the blue one day.
/Dmitri.
I quote Rick He:
The issue could be that your database has case insensitive collation and distribution column name specified in the table DDL is "different" from column name in column definition in terms of lower/upper cases.
For example, your original table DDL could be like:
create table tableA (colABC int) with (distribution=hash(colabc))
In this case your BCP(SqlBulkCopy) might stop working recently. This is a product issue. The latest GA release has this issue, and the team is trying to fix this issue now.
Workaround for now: Create a new table to make sure column names are exact the same. Take above example:
create table tableA (colABC int) with (distribution=hash(colABC))

SQL Azure Import Error - Operand type clash: image is incompatible with geography

My database contains a table with Geography column having spatial data.
Importing its .bacpac (Data-tier App) on SQL Azure Standard fails without giving any proper error details.
Tried a direct Data Export using wizard and received an error:
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 OLE DB Provider for SQL Server" Hresult: 0x80004005 Description: "Operand type clash: image is incompatible with geography".
(SQL Server Import and Export Wizard)
Any idea why Geography is a problem here?
Update
I recently upgraded SSMS to 2016 and this error has gone. It must have been due to older version of SSMS that didn't support import export of spatial data.

SQLServer SSIS Error connecting to AS400

I made a data source with this propierties:
Provider "Native OLE DB\IBM DB" for i5/OS IBMDA400 OLE DB Provider",
User id and the password are filled.
Persist Security is true.
Catalog library list is filled.
I made the connection manager based on the data source, I made a OLE DB Source with this Connection manager, It show me the list of the tables name, I choose the table I need But when I click OK SSIS returns an error that says:
Error at Data Flow Task [OLE DB Source [1]]: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "IBMDA400 Session" Hresult: 0x80004005 Description: "CWBZZ5010 Error de comunicaciones con el sistema ###.#.##.# ".
Error at Data Flow Task [OLE DB Source [1]]: Opening a rowset for ""XXXXXX".XXXX" failed. Check that the object exists in the database.
------------------------------
ADDITIONAL INFORMATION:
Exception from HRESULT: 0xC02020E8 (Microsoft.SqlServer.DTSPipelineWrap)
I hope you understand me, I have a pretty poor english. Ty
Looks like you have a timeout connection problem.
Check this IBM technote
I tried with ADO NET manager Connection and It works. Ty all

Multiple-step OLE DB operation generated errors...SSIS VS2005 Business Development Studio

When developing SSIS package using VS 2005, I set up the connection manager for oledb teradata provider and added a oledb source and destination. For oledb source, I used the data access mode as sql command and added sql command text. But when I tried to do column mapping, I'm getting an error message which is detailed below.
Error at All Transactions [OLEDB Source [1627]]:
An OLEDB error has occurred. Error code: 0x80040E21.
An OLE DB record is available. Source: "OLE DB Provider for Teradata" Hresult:
0x80040E21 Description: "Multiple-step OLE DB operation generated errors. Check
each OLE DB status value, if available. No work was done.".
ADDITIONAL INFORMATION:
Exception from HRESULT: 0xC0202009 (Microsoft.SqlServer.DTSPipelineWrap)
BUTTONS:
OK
Please let me know why such error throws. I have a workaround which is described as follows.
when you store the sql within ( and ) and alias the query and set the data access mode as table name or view name variable, then it works fine.
Without any more information on the SQL being used in the OLEDB Source component, I can try and guess. Maybe the issue is with the SQL that is returning columns with the same name or similar situation that leads to incorrect metadata.
I just got this error and I simply edited the provider to a different provider, tested, and then set it back to the original provider. In my case I was using OLEDB Native client 11 so I set it to 10 and then back to 11.
My guess is the XML got corrupted somehow as my package has been working forever.

Importing from Oracle to SQL Server

I am using SQL import/export wizard to import a table from oracle, SQL wizard is generating the following error.
TITLE: SQL Server Import and Export Wizard
------------------------------
Could not connect source component.
Error 0xc0202009: Source - PORTRAIT [1]: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005.
Error 0xc02020e8: Source - PORTRAIT [1]: Opening a rowset for ""FLDADMIN_TEST"."PORTRAIT"" failed. Check that the object exists in the database.
------------------------------
ADDITIONAL INFORMATION:
Exception from HRESULT: 0xC02020E8 (Microsoft.SqlServer.DTSPipelineWrap)
Although I can import other table without any problems. I noticed that Portrait table is partitioned, if this is the problem?how can I import such table?
Thank you,
Ihab