考虑这个SQL:
while (@Level<6)
begin
if (not exists(select 1 from tbtask where row_guid in (select Row_GUID from Cad_Catalog where CatalogID=@TaskCatalogID)))
begin
select @TaskCatalogID=PcatalogID from Cad_Catalog where CatalogID=@TaskCatalogID
set @isUserCreateCatalog=1
end
else
break
set @Level=@Level+1
end
执行else
andbreak
时,它仍然执行。
set @Level=@Level+1
break
跳转到while循环!
如果它执行set @Level=@Level+1
????? 所以我认为
set @Level=@Level+1
没有用!真的吗?