• I have an unmodified AdventureWorks database. 1 and 2 work fine. 3 and 4 fail.

    3 gives:

    Msg 207, Level 16, State 1, Line 2

    Invalid column name 'EmployeeId'.

    4 gives:

    Msg 8127, Level 16, State 1, Line 2

    Column "HumanResources.Employee.ManagerID" is invalid in the ORDER BY clause because it is not contained in either an aggregate function or the GROUP BY clause.

    EDIT: this is MSSQL 2005 SP2 9.0.3073 64-bit