Ok - got this SPROC
and as you see I have no BEGIN TRAN and COMMIT...Code:Create Procedure awc_PartGeneral_Add @Part varchar(100), @username varchar(100)--@SQLGuid varchar(36) As Set NoCount On Declare @ND datetime Declare @Seq int Declare @NoteKey varchar(100) Declare @SK varchar(100) Set @ND=Convert(varchar(10),GetDate(), 101) Set @Seq=IsNull((Select Max(Seq) From PartNotes_T Where PartId=@Part and NoteDate=@ND),0)+1 Insert into PartNotes_T values (@Part -- PartId ,@ND -- NoteDate ,@Seq -- Seq ,'N' -- Face ,15 -- TimeSpent ,@username -- AddedBy ,'' -- ContactType ,'OtherPhone' -- MetWhere ,'' -- MetWith ,'' -- Note ,GetDate() -- TDate ,'N' -- Conservator ) Set @NoteKey=Scope_Identity() Set @SK='~save~'+@NoteKey Select '["save","add","undo"]' "buttons" ,'{"focus": "NoteDate"}' "awcoptions" Exec awc_PartGeneral_Edit @Part,@SK
I kind of always thought a SPROC was automatically contained in a TRANSACTION.
But it seems that two different users were maintaining the same "participant" and adding a note - and the SEQ number passed back to the UI was the "same" for both users.
I can only think that the Set @Seq=... is grabbing the same number because the INSERT had not happened yet - and that's only possible if the each SPROC line is not in a transaction.
Part of me does not want to believe the user - but they are saying it happened although not with enough technical info to be really firm.
I'm not sure how to even try to replicate the problem so I can see it really happen and then prove I fixed it...




Reply With Quote