insert into sometab values (somevalues)
set @outparam = @@identity
insert into someother tab values (@outparam....)
if @@error <> 0
dbcc checkident('sometab') --this is what i have added now
this i have done as due to rollback the identity should not have increased.
Hmmm...that's funny. I'm trying to image by looking at your code how the identity would increase, even though the transaction is being rolled back, but I can visualize it. Oh well. Looks like that DBCC command worked for you, so I'd quit while I'm ahead!
Identity is designed for multitasking.
If you insert values 1-3, others can insert 4-5. If you rollback and they don't, they must have values 4-5. So you must write your own multitasking code for values without gaps.
it Wouldnt be ideal as conflicts will also arise when someone is editing the table.
where time would be the essence this wont really work. i have seen it happen.. even though the lock is for the minimal of time, any procedure which has to wait for another to release isnt the ideal construct.