SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


T-SQL query


T-SQL query

Author
Message
Peter Schott
Peter Schott
SSCrazy
SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)

Group: General Forum Members
Points: 2786 Visits: 1930
Maybe that's why we keep getting these QoDs - the poster inherited a system using this awful code. Wink

That being said, this is the second of these strange "out of the box" type questions. It was pretty poor last time and equally poor this time. The solution given may be technically correct, but it doesn't show better ways of doing it and breaks once you switch from English to just about any other language.

I'd love to see just a little more screening for better QoDs rather than get another one of these. It's not just that it's not really challenging to figure "yes, there must be another way", but the answer is lacking. There are multiple solutions and I probably wouldn't mind if more of those were listed, but just to leave the language-specific solution in the answer alone makes it a pretty poor question/answer.
jean-noel staub
jean-noel staub
Forum Newbie
Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: General Forum Members
Points: 3 Visits: 8
the answer is not an multilingual answer ! i prefer to use the month number!
mike brockington
mike brockington
SSC Veteran
SSC Veteran (258 reputation)SSC Veteran (258 reputation)SSC Veteran (258 reputation)SSC Veteran (258 reputation)SSC Veteran (258 reputation)SSC Veteran (258 reputation)SSC Veteran (258 reputation)SSC Veteran (258 reputation)

Group: General Forum Members
Points: 258 Visits: 245
Stupid question, pointless answer, 'nuff said.

Throw away your pocket calculators; visit www.calcResult.com


StarNamer
StarNamer
SSCrazy
SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)

Group: General Forum Members
Points: 2780 Visits: 1992
Although I realised that this was another silly question which was going to have an answer which was language specific, inflexible and basically stupid, my immediate thought was to use Boolean algebra. Smile

Since 'A OR B' can alwasy be rewritter as 'NOT (NOT A AND NOT B)' then the (still silly) solution of

where
mob = 1
or mob = 3
or mob = 4
or mob = 5
or mob = 7
or mob = 8

can be rewritten as
where not (
mob <> 1
and mob <> 3
and mob <> 4
and mob <> 5
and mob <> 7
and mob <> 8
)

Which satisfies the (poorly specified) requirement of using neither IN nor OR. BigGrin

Derek
Shaun McGuile
Shaun McGuile
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1121 Visits: 1060
mike brockington (5/6/2008)
Stupid question, pointless answer, 'nuff said.


I totally agree - English question - English Answer

Does it work in Swahili, Spanish, French and German? Can I spell Swahili?

BigGrin 'If you database was not adequately designed - accept your applications will be crap!' BigGrin

--Shaun Tzu's Art of DBAdmin and Design

Hiding under a desk from SSIS Implemenation Work Crazy
5409045121009
5409045121009
SSC Veteran
SSC Veteran (234 reputation)SSC Veteran (234 reputation)SSC Veteran (234 reputation)SSC Veteran (234 reputation)SSC Veteran (234 reputation)SSC Veteran (234 reputation)SSC Veteran (234 reputation)SSC Veteran (234 reputation)

Group: General Forum Members
Points: 234 Visits: 681
Select (datepart(m,getdate())-1)*(datepart(m,getdate())-3)*(datepart(m,getdate())-5)*(datepart(m,getdate())-7)*(datepart(m,getdate())-8)
Smile



hayk-736382
hayk-736382
Grasshopper
Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)

Group: General Forum Members
Points: 10 Visits: 22
Totally agree.This type of questions make look the problem from different angle.
Angel Sánchez R
Angel Sánchez R
Valued Member
Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)

Group: General Forum Members
Points: 71 Visits: 68
"Like" no es un operador que pertenece a los "Search Arguments"
steve smith-401573
steve smith-401573
SSCrazy
SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)

Group: General Forum Members
Points: 2469 Visits: 744
And, here I am, misinterpreting the question. I read it as using EITHER would satisfy the condition of not using BOTH!

There's always an orthogonal way to read something obvious. Personally, i think that using neither ... nor... would have been more unambiguous.
Shaun McGuile
Shaun McGuile
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1121 Visits: 1060
steve smith (5/28/2008)
And, here I am, misinterpreting the question. I read it as using EITHER would satisfy the condition of not using BOTH!

There's always an orthogonal way to read something obvious. Personally, i think that using neither ... nor... would have been more unambiguous.


You hit the nail on the head mate. We are all after all a rather pedantic and suposedly precise set of people - therfore abiguity needs to be eradicated with extreme predjudice, else we will interpret.
(and the client will get precisely what they asked for not what they want).

Hiding under a desk from SSIS Implemenation Work Crazy
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search