• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 447
  • Last Modified:

Error handling with Error 2601

I make with my sp insert statements in a table(1) with two indexes.
The indexes are both INT and are managed with own tables (2) and (3).
Now it can happen that a administrator makes also insert statements manual and forget to update the Index manage tables (2) or/and (3).
If my sp now will write down the next dataset I get the Error 2601.
This Error occurs by both indexes.
How can I find out now wich index I have to correct it? Or how can I get the column name of the error index? I think it is not reliable to extract the Error_message.
0
Opusretis
Asked:
Opusretis
1 Solution
 
pcelbaCommented:
Hmm, stupid administrator could do even worst things...

You should think if you have to add some conditional data testing before each insert (to indicate manual data integrity corruption) or if you rather change the administrator or if you write a set of SPs for administrative use which could update tabels 2 and 3 automatically.

So, if you have SP for insert statements then you should check if the inserted values are valid before the operation itself. Some automatic increment of values in table 2 and 3 would also be possible.

And if the error just occured and you don't know which table contains wrong value then you have to query both table 2 and 3 and compare values against data in table 1. Broken uniqueness is easy to trace.
0
 
OpusretisAuthor Commented:
The proposal is good because it avoid an Error but it is not an Errorhandling.
Whatever the problem is solved!

Thank you
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now