marcingminski/sqlwatch

Primary Key Violation

3ricb4nk opened this issue · 11 comments

Violation of PRIMARY KEY constraint 'pk_sqlwatch_logger_perf_procedure_stats'. I get this error on a brand new installation when the SQLWATCH-LOGGER-PROCS job tries to run. From the very first time.

what version?

Are you able to run the code from the procedure in a way that will show you the dataset in the SSMS so we can understand where the violation is coming from?

Sorry, version is 4.3.0.23725.20210721131116

I can run the proc so that it returns a result set, yes. What format would you like it saved to?

CSV, XLS, whatever is easier for you.

Here's an excel version of the results that usp_sqlwatch_logger_procedure_stats returns. The error from sqlagent is this:

Executed as user: DCSDK12\sqlsvrsvc. Violation of PRIMARY KEY constraint 'pk_sqlwatch_logger_perf_procedure_stats'. Cannot insert duplicate key in object 'dbo.sqlwatch_logger_perf_procedure_stats'. The duplicate key value is (ITS-SQLCLUS\SQLCLUSDEV, 14, 317, 2021-10-21 21:30:31, 27, Oct 19 2021 8:06PM). [SQLSTATE 23000] (Error 2627). The step failed
SQLWatch_Logger_Procedure_Stats.xlsx
.

Thanks, let me review and I will come back to you

Many thanks.

Any ideas, thoughts, comments?

Hi, apologies, swamped with other priorities. It's still on my to do list.

Hello @marcingminski. By any chance this error still has no solution?