以下のようなことをやっても特に問題はなかった。
create table TEST (YMD VARCHAR(8)); insert into TEST values ('20150101'); insert into TEST values ('20150102'); insert into TEST values ('20150103'); insert into TEST values ('20160101'); insert into TEST values ('20160102'); insert into TEST values ('99999999'); begin -- 取引先コードの更新 declare crList cursor for select distinct substring(YMD, 1, 4) as GRP from TEST; open crList; declare @GRP varchar(99); fetch next from crList into @GRP; while @@fetch_status = 0 begin -- ●更新sql update TEST set YMD = 'UPDATE' where YMD like @GRP + '%'; fetch next from crList into @GRP; end; close crList; deallocate crList; end;