question

Mia-0205 avatar image
0 Votes"
Mia-0205 asked Monalv-msft commented

User Account receives primary key violation but not another user

Hi

We're trying to set up a proxy user to run an SQL Server job, but there are steps in the SSIS package with are MERGE statements.

The user account set up, which has sysadmin rights against the databases, receives a 'Violation of PRIMARY KEY constraint' error when doing this statement. Another user, with the exact same security permissions, does not get this violation, and not does the SQL Server Agent.

When separating the statement out to its separate parts, inserting in TEMPDB, and then doing a MERGE, no such violation occurs.

I have been unable to find any reference to this problem, and any assistance would be greatly appreciated. We're using SQL Server 2016.

Thanks.

sql-server-generalsql-server-transact-sqlsql-server-integration-services
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Monalv-msft avatar image
0 Votes"
Monalv-msft answered Monalv-msft commented

Hi Mia,

May I know if you insert the duplicated value into the table with Primary Key?

Hope the following links will be helpful:

Dealing with Violation of PRIMARY KEY constraint SSIS [closed

I am using ssis and I am getting this error "Violation of PRIMARY KEY constraint .Cannot insert duplicate key in object . The duplicate key value is


Best Regards,
Mona



If the response is helpful, please click "Accept Answer" and upvote it.


· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi Mia,

May I know if you have anything to update?

Best Regards,
Mona

0 Votes 0 ·
TomPhillips-1744 avatar image
0 Votes"
TomPhillips-1744 answered

PK violations are not related to security in any way. You must have a logic or data issue.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.