ORDER BY

  • For the sake of sanity this thread needs closing;:D

    The point of the question is not wether you agree with the way it is written or what you believe the correct answer should be, or wether you got it right or wrong! 😛

    The point is this SQL2000 implements SQL badly - the query as stated should throw an error under correct SQL implementation.

    The ORDER BY clause should require uniquely named columns in the answer set of rows.

    The first column is not a table column but an expression column.

    The answer set could not be used in further SQL as an ambiguous column name error will be thrown.

    Using select * and not explicitly referencing your answer columns is lazy and bad practice.

    To see how bad this flaw in SQL2000 is go to page 6 of this thread.

    --Shaun

    Hiding under a desk from SSIS Implemenation Work :crazy:

  • first-of-all, u read the question first and give the comments to others.

    I feel, u didn't read very well.

    the question is

    select start_date,* from employee order by start_date desc

    from this query, what type of result u got. this is the question.

    first u apply and come to argu with me.

    bye.

  • Its is working fine in SQL 2000. Pls be clear asking questions!

  • It works fine with SQL Server 2000 ....

  • sai.adarsh (4/16/2008)


    It works fine with SQL Server 2000 ....

    Yes, many of us have said this, including me. But I've yet to have the acknowledgement that our clearly correct answer-that-works reflected in my score.

    Sadly, our in-the-field knowledge contradicts the poster's limited knowledge of SQL in-the-field even though the answer clearly asks for the in-the-field result of a SQL statement.

    You see, if the result does not match the poser's idea of reality, even when they ask for the reality rather than some theoretical response, then it can't be real, despite the obvious evidence to the contrary.

  • OOh! here is a real world example of why you people need to buck up your ideas -

    Why SQL2000 does not give a correct answer

    http://www.sqlservercentral.com/Forums/Topic484145-8-1.aspx

    Reality in a large dose! 😀

    --Shaun

    Hiding under a desk from SSIS Implemenation Work :crazy:

  • Please provide all the information about the situtation and/or enviorment .

    It will work perfectly fine with SQL Server 2000.

    But not with SQL Server 2005:)

  • brewmanz.sqlservercentral (4/16/2008)


    Sadly, our in-the-field knowledge contradicts the poster's limited knowledge of SQL in-the-field even though the answer clearly asks for the in-the-field result of a SQL statement.

    Jeez - you make one mistake, post up an explanation, and 15 pages later, still being persecuted!:crazy:

    Everyone - just accept that humans are fallable; that you aren't going to get a point for assuming you have the correct answer (which you can easily make up for by posting something worthless here like 'it doesn't work for me!'; and that you MIGHT have just learned something about T-SQL syntax.

    Then submit your own QOTD, but beware, if it isn't 110% unambiguous, 120% correct and completely closed to misinterpretation - we'll be waiting in the shadows, ready to jump out, dripping in smugness, armed with our own 'it didn't work for me' t-shirts ....or maybe we'll just let you walk by, chalk it up to 'life', and possibly even see the learning that was intended....... 😉

  • Kev - dude some people are just not prepared to listen to us. 😉

    Like Jeff says 'just give them enough room to fail' 😀

    Yay like 15 pages is that a record?!?

    By the way is your cross made of oak? I think they gave me an oak one! 😀

    (The one they crucified you on).

    --Shaun

    Hiding under a desk from SSIS Implemenation Work :crazy:

  • No didn't get an oak cross - apparently there wasn't enough clarification of what kind of tree was needed so I got a cross made of leaf nodes from a SQL 2005 B-tree. 😛

    Some people are just far too serious for their own good! I can't see this thread ending for at least another 5 pages.....

  • Hey kev,

    this works in 2000!

    Just thought after 15 pages that someone should let you know! 😉

    Q

    Please take a number. Now serving emergency 1,203,894

  • brewmanz.sqlservercentral (4/16/2008)


    sai.adarsh (4/16/2008)


    It works fine with SQL Server 2000 ....

    Yes, many of us have said this, including me. But I've yet to have the acknowledgement that our clearly correct answer-that-works reflected in my score.

    Sadly, our in-the-field knowledge contradicts the poster's limited knowledge of SQL in-the-field even though the answer clearly asks for the in-the-field result of a SQL statement.

    You see, if the result does not match the poser's idea of reality, even when they ask for the reality rather than some theoretical response, then it can't be real, despite the obvious evidence to the contrary.

    Posting this response gained you the point you "lost" on this question. Since you have posted on this topic multiple times, you've actually increased your score because of your wrong answer.

    The real question for everyone is, did you learn any of the far more valuable lessons this question teaches? I could care less how many points I have, but since I deal with a mixed installed base of SQL 2000 and 2005, I'm glad this highlighted a very key difference in how the versions behave.

  • WOW !!!! :smooooth:

  • Hai.

    I think this question's answer is correct but you mentionig as wrong one.

    and also i have tried it in sql server 2000 and it work perfectly.

  • The answer is partly correct. The query works pretty well and outputs the resultset correctly in SQL Server 2000. We need to prefix table name/ alias in SQL Server 2005. The question would have more detailed explanation.

    Muni Reddy BN

    Sr. DBA

Viewing 15 posts - 136 through 150 (of 182 total)

You must be logged in to reply to this topic. Login to reply