EXEC UpdateTransNo #{site},#{no} INSERT INTO [dbo].[other_roll_trans_no]([order_no], [seq_no], [next_no]) VALUES (#{orderNo}, #{seqNo} , #{nextNo}); update other_roll_trans_no set next_no = next_no+1 where order_no = #{orderNo} and seq_no = #{seqNo} update TransNoControl set NextNumber = case when NextNumber is null then 2 else NextNumber + 1 end where Site = #{site} and TransType = #{no}