ORDER BY

  • Comments posted to this topic are about the item ORDER BY

  • Hi,

    I think question and answer aren't synchronous.

    If it is question for SQL 2005 Server then good answer is:

    "Msg 208, Level 16, State 1, Line 1

    Invalid object name 'Employee'."

    If your default Schema is not Schema to which employee table belongs.

    If it is question for SQL 2000 Server (what syntax suggest :)) then good answer is:

    "All columns and all rows from the employee table in descending start_date order, with the start_date as the first column"

  • For SQL SERVER 2000 it will work

  • For SQL Server 2000 the statement will succeed... For SQL 2005 you need to qualify the Order by statement with the table name. This question should have been written more clearly.

    Thanks

    Un happy Member (I answered it from a 2000 point of view)

    Thanks

  • The question doesn't specifically mentioned this is for SQL Server 2005, so I think we SQL Server 2000 users deserve some credit for answering "A" 😀


    Urbis, an urban transformation company

  • Dear Friend,

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

    It will work perfectly fine with SQL Server 2000.:D

    But not with SQL Server 2005.

    Thanks.

    Regards,

  • Hi all

    The suggested Answer is wrong

  • i do not think it's a matter of sql server version. ideally you/we should be able to answer without running the command.

    but if you still want to run it, no one prevents you from adapting the script to match your (test) environment, table names, column names... etc

    dragos

  • This works OK in SQL server 2000.

    The question didn't specify which SQL version.

    😎

  • Hmm.

    We have a multiple guess question that asks, "if you do this, what'll happen?". There isn't an option for, "in some situations this, in others that", so either there are two right answers or there aren't any.

    Unfortunately, the QOTD, whilst only being a bit of fun (and good fun at that), suffers from rather frequent bad phrasing. I suspect Steve simply hasn't the time for the required level of sanity-checking.

    Semper in excretia, suus solum profundum variat

  • Hi,

    The question is not version specific. Please make sure to mention the version on the future questions.

  • I try with SQL 2005 and that works perfectly.

  • @kenny, is the database you tried your query against set at compatibility level 8.0? If so, you're right that it'll work fine. However, changing the compatibility level to 9.0 (obviously not on a db of any kind of importance if you're changing just to answer a QOTD ;)), it'll give the error stated as being the correct answer.

    Semper in excretia, suus solum profundum variat

  • Hi,

    The suggessted answer is wrong, For SQL server 2000 the query runs successfully without any error and the option A is correct.

  • Another way of doing this is

    select start_date as [Date], *

    from employee

    order by [Date] desc

Viewing 15 posts - 1 through 15 (of 182 total)

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