I\'m creating a stored function which should insert new row to table. In this table is also one unique column.
How can I check if everything goes well and row reall
Stored Procedures are "all-or-nothing"
Therefore, if you include an INSERT
in the sproc, and that INSERT
fails on a duplicate key error, the entire sproc will be rolled back.
If the sproc executes without error, you can be confident that the INSERT
did not have an error. Now, this does not mean the INSERT
actually happens just because the sproc completes, just that there were no errors.... for example, if you had some WHERE
clause which excludes the INSERT
but doesn't throw an error then there may be some ambiguity.