Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Null in where clause
Message
From
22/02/2001 15:36:10
 
 
To
22/02/2001 15:20:32
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00478555
Message ID:
00478609
Views:
22
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform