カーソルを使用してヌル列を更新していますが、更新されていません
Declare @Itemcode as varchar(30)
Declare @SLV as varchar(20)
declare cursor1 cursor for
Select Itemcode ,U_SLV from oitm_Clone where sapitem is null and u_slv is null
open cursor1
fetch next FROM cursor1 INTO @Itemcode ,@SLV
WHILE @@FETCH_STATUS = 0
begin
if @SLV is null
begin
declare @sql1 as varchar(max)
set @sql1 = 'Update [dbo].oitm_Clone set sapitem ='''+ @Itemcode +''' where ItemCode='''+ @Itemcode +''' and U_SLV ='''+ @SLV +''''
print @sql1
execute (@sql1)
end
FETCH NEXT FROM cursor1 INTO @Itemcode ,@SLV
end
CLOSE cursor1
DEALLOCATE cursor1