Home Forums SQL Server 2012 SQL Server 2012 - T-SQL Sorting working differently after moving from SQL Server 2008 to 2012 RE: Sorting working differently after moving from SQL Server 2008 to 2012

  • One other thing Melanie, unless there's more to the code than you've shown, the temp table isn't needed at all. This should be more efficient

    SELECT '-1' AS EmpLogin, 'Please Select' AS AttorneyName

    UNION ALL

    SELECT RTRIM(LTRIM(EmpLogin)) + '|' + RIGHT(PhoneNumber,4), AS EmpLogin

    LastName + ', ' + FirstName AS AttorneyName

    FROM dbo.Employees

    WHERE JobCode BETWEEN 100 AND 500

    AND EmpTermDate IS NULL

    ORDER BY AttorneyName

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass