Wednesday, November 01, 2006
Useless Query
09:38 |
Posted by
Sean McCown |
Edit Post
I just ran across this in an SP and I thought I'd share it with you guys...
Select RegionName from Regions
where RegionName IN ('SC', 'MW', 'NE', 'NC', 'NW')
For some reason, I just love the uselessness of this whole thing.
Select RegionName from Regions
where RegionName IN ('SC', 'MW', 'NE', 'NC', 'NW')
For some reason, I just love the uselessness of this whole thing.
Subscribe to:
Post Comments (Atom)
About Me
- Sean McCown
- I am a Contributing Editor for InfoWorld Magazine, and a frequent contributor to SQLServerCentral.com as well as SSWUG.org. I live with my wife and 3 kids, and have practiced and taught Kenpo for 22yrs now.
Labels
Blogumulus by Roy Tanck and Amanda Fazani
2 comments:
There is a sense in that. Imagine the following table contents:
insert into Regions (RegionName)
select 'SC' union
select 'NW' union
select 'NA'
Now try your query. As you can see, output will be limited by both IN() list and table data. But yes, I doubt that authors of such crap ever think about this weird case... :)
Do I need to be American to understand the uselessness of this sp?
Post a Comment