Hello!

I tried a simple while loop, look what the error is - I don’t understand ...

USE aaa go WHILE (SELECT * FROM t4 WHERE ch3<2) BEGIN UPDATE t4 SET ch4=ch4+1 break END 
  • one
    what a dialect. while break, etc. - this is not SQL, these are its extensions - renegator
  • Apparently Transact-SQL - Barmaley

1 answer 1

(select * from t4 where ch3<2) is a condition, but it is executed incorrectly, not a logical condition. As I understand it, you need to add EXISTS:

 while EXISTS(select * from t4 where ch3<2)