October 2, 2009 at 12:25 pm
SELECT * FROM Table1 WHERE ID = @ID AND (@a> 0 OR @b-2>0)
... would fix a part of that but understood on the no return even if it has no rows. Thanks for the correction.
--Jeff Moden
Change is inevitable... Change for the better is not.
October 2, 2009 at 12:57 pm
Jeff Moden (10/2/2009)
SELECT * FROM Table1 WHERE ID = @ID AND (@a> 0 OR @b-2>0)... would fix a part of that but understood on the no return even if it has no rows. Thanks for the correction.
Honestly, I think that part of the specification is wrong, from a technical perspective, but since we haven't heard back after several people pointed that out, there's no way to know.
I'd do pretty much the same thing as you did, but I'd have written it "and not(@a = 0 and @b-2 = 0)". Just reads more clearly to me, more direct translation of the business rule, no other reason. Though, depending on the values, you might need to check less than zero as well as greater than, to use your version. Again, no way to know without further data from the OP.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
Viewing 2 posts - 16 through 16 (of 16 total)
You must be logged in to reply to this topic. Login to reply