If you have a procedure with multiple inserts, you check if each one is successful when SCOPE_IDENTITY() IS NOT NULL.
1 - Declare a variable to hold the flag (@flag tinyint)
2 - Initialize it (SET @Flag = 0)
3 - After the first insert check SCOPE_IDENTITY()
(IF SCOPE_IDENTITY() IS NOT NULL
SET @Flag = @Flag + 1)
4 - After the second insert check SCOPE_IDENTITY()
(IF SCOPE_IDENTITY() IS NOT NULL
SET @Flag = @Flag + 2)
5 - Finally at the end of the procedure, return the value of @Flag.
If @Flag = 0, neither succeeded. If @Flag = 1, only the first succeeded. If @Flag = 2, only the second succeeded. If @Flag = 3, both succeeded. Good luck!
--John
![[rainbow] [rainbow] [rainbow]](/data/assets/smilies/rainbow.gif)
-----------------------------------
Behold! As a wild ass in the desert
go forth I to do my work.
--Gurnie Hallock (Dune)