Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Eliminating WHERE clauses with NOT
Message
 
 
À
04/11/2014 13:35:24
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2012
Application:
Web
Divers
Thread ID:
01610458
Message ID:
01610486
Vues:
31
>>This thing is still very hard to understand for me. I think the easiest here would be
>>
>>and Client.ModDate >=@MinDateOf3Dates OR Client.NoStatus NOT IN (@Status1, @Status2, @Status3)
>
>Yes, it the date would always be the same value. But, that was just an example.

I think you should try to express the logic as simple as possible in order to easily understand months from last time you looked at.

Say, if I see

status = @Status or status = @AnotherStatus or status = @ThirdStatus

I always suggest a re-write into this form

status in (@Status1, @Status2, @Status3)

which is much shorter and easier to understand especially when combined with other conditions.

So, my suggestion would be to simplify as much as possible.
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