I have quite a simple question I think, but I need a definitive answer. I can’t think of way to test out my ideas because it depends on a transient error (out of my control)
SQL Azure is prone to transient errors, timeouts, rejected connections etc. Sometimes on opening the connection, other times when executing a query.
I am inserting a row into SQL Azure via a stored procedure (it’s basically a messaging system, so each message should be sent/inserted only once).
If a transient error occurs, my system waits a few seconds, then tries again … repeating until the stored procedure executes without any errors.
I need the stored procedure to either insert the row and confirm to me that it has been inserted OR to fail completely and NOT insert it.
At the minute, I’m finding that when the database is going through a really bad patch, a message can end up being sent several times.
What would a system that deals with financial transactions do?
Since it’s jut one insert statement, am I right in thinking wrapping it in a transaction would have no effect?
Can anyone clarify for me or even point me to some documentation I should read to figure it out myself?
As per the suggestion by gbn, I added an extra key, not an identity, that I could use to identify duplicates and check on this before inserting