Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Where-Clause barks at moon

Author  Topic 

DeepRedWill
Starting Member

4 Posts

Posted - 2009-08-26 : 15:04:37
Hi there. I'm evaluating some SQL right now and came across some weird where clauses.


...
WHERE len(desc) <> 12 AND len(desc) <> 13


What that does is exclude anything 12 or 13 digits long. 'or' being the operative word there. In a few test cases I've run it through it works just fine, even though it makes my inner child cry. I was not at all prepared for what I found next:


...
WHERE prod_id IS NULL AND prod_id IS NOT NULL


That doesn't [seem to] do the same thing as the above. It [seems to] disallow everything. Though it's not likely since the proc this is contained in [seems to] works.

Any feedback on these weird WHERE clauses would be appreciated, since Google seems to be silent on the issue.

Thanks!

Will

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2009-08-26 : 15:10:39
the 2nd one will filter out all results. sp will return nothing.
Go to Top of Page

DeepRedWill
Starting Member

4 Posts

Posted - 2009-08-26 : 15:14:04
As I suspected!!

Thanks a lot
Go to Top of Page
   

- Advertisement -