The IF statement we looked at on Tuesday was pretty tame compared to the WHILE construct. Actually, the main thing you need to keep in mind is that WHILE is all you have. There is no such thing as a FOR loop or a DO WHILE loop. So, you have to force WHILE to do those for you. The basic syntax of WHILE looks like this:
1 | DECLARE @someString as VARCHAR |
So if you want a FOR/NEXT loop, you’ll need to write:
1 | DECLARE @someInt as int |
and a DO WHILE loop would be something like:
1 | DECLARE @someInt as int |
Once you learn to substitute those constructs for your normal FOR/NET or DO WHILE code, it becomes rather easy to deal with. Now if they’d just replace BEGIN with { and END with } I think I could live with this.