Declare @i intset @i=1while @i<11
begin
  update sx set fs= case when case when substring( content,i,1)= substring(da,i,1) then 4 else 0 end
  select @i=@i+1
end

解决方案 »

  1.   


    Declare @i int,@sumset @i=1
    update sx set fs=0
    while @i<11
    begin
      
      update sx set fs= fs+case when case when substring( content,i,1)= substring(da,i,1) then 4 else 0 end
      select @i=@i+1
    end
    上面那个没有累加,有问题
      

  2.   


    Declare @i intupdate sx set fs=0set @i=1
    while @i<11
    begin  update sx set fs= fs+(case when substring( content,@i,1)= substring(da,@i,1) then 4 else 0 end)
      select @i=@i+1
    end