Change like this & try:-DECLARE @FindString varchar(80)DECLARE @ReplaceString varchar(80)SET @FindString = 'Brodmann-10'SET @ReplaceString = 'Broadmann-1910'SET NOCOUNT ONDECLARE @TextPointer varbinary( 16 ) DECLARE @DeleteLength int DECLARE @OffSet intDECLARE @ID intSET @DeleteLength = len( @FindString ) SET @OffSet = 0SELECT @ID=MIN(PKCol)FROM BrodmannWHERE charindex('%Brodmann-10%', Description) <> 0WHILE @ID IS NOT NULLBEGIN SELECT @TextPointer = textptr( Description)FROM Brodmann --Brodmann is a table only has 5 rowsWHERE PKCol=@IDSELECT @OffSet = charindex( '%Brodmann-10%', Description) -1FROM BrodmannWHERE PKCol=@IDUPDATETEXT Brodmann.Description@TextPointer@OffSet@DeleteLength@ReplaceStringSELECT @ID=MIN(PKCol)FROM BrodmannWHERE charindex('%Brodmann-10%', Description) <> 0AND PKCol>@IDENDRETURN
Where PKCol is the primary key column of Brodmann table