use astrealerpdba
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE dbo.changemr
@counter int
,@prevmrno nchar(9)
,@newmrno nchar (9)
AS
BEGIN
SET NOCOUNT ON;
DECLARE @count int
SET @count=1
WHILE @count<=@counter
SET @prevmrno=@prevmrno+1
SET @newmrno =@newmrno +1
UPDATE mrinf set mrno=@newmrno where comcod=3305 and mrno=@prevmrno
SET @count = @count+1
END
GO