Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Null in where clause
Message
De
22/02/2001 15:36:10
 
 
À
22/02/2001 15:20:32
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00478555
Message ID:
00478609
Vues:
21
Another way might be (untested):
WHERE ISNULL(mydatefield, '19000101') = ISNULL(@dateparm, '19000101')
assuming Jan 1st, 1900 is never actually used in your application. Personnaly, I prefer the other method, since I find it more readable and obvious.

>How about:
>
>
WHERE (@dateparm IS NOT NULL AND mydatefield = @dateparm)
>   OR (@dateparm IS NULL     AND mydatefield IS NULL)
Sylvain Demers
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform