Thanks, this is what I came up withUSE [LabBR1]GO/****** Object: StoredProcedure [LAB].[UpdateLocationDNA] Script Date: 01/19/2014 09:20:56 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGO ALTER Procedure [LAB].[UpdateLocationDNA]@volunteerID INT, @StudyNameID INTAsBegin DECLARE @Boxid INT SET @Boxid = (SELECT MAX(Box) FROM [LAB].[tblDNAlocation])DECLARE @id INT SET @id = (SELECT MAX(Location) FROM [LAB].[tblDNAlocation] WHERE Box = @Boxid ) IF @id = 100BEGINSET @id = 0SET @Boxid = @Boxid +1UPDATE [LAB].[tblDNAlocation]SET Location = (isnull(@id, 0) % 100) + 1, Box = @BoxidWHERE Location is null AND VolunteerID = @volunteerID AND StudyNameID = @StudyNameID ENDELSEUPDATE [LAB].[tblDNAlocation]SET Location = (isnull(@id, 0) % 100) + 1, Box = (isnull(@Boxid, 1)% 100) WHERE Location is null AND VolunteerID = @volunteerID AND StudyNameID = @StudyNameID End