Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Conditional Logic
Message
 
 
À
17/06/2008 11:28:37
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2005
Divers
Thread ID:
01324772
Message ID:
01324777
Vues:
11
This message has been marked as the solution to the initial question of the thread.
Use one extra variable and do your processing outside the loop in the third case.

E.g.

declare @TestVar = 0

>I need to do something like the following in a query.
>
>
>
>DO WHILE looping through fetched rows and @MyVar changes value
>
>BEGIN
>
>IF @MyVar = 1
>     BEGIN
>          Do This
>     END
>
>IF @MyVar > 1
>     BEGIN
            set @TestVar = 1
  
>          Do This
>     END
>    >
IF @TestVar = 0

&& All your myVar are 1 (or less than 1), so you can try extra processing.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform