• Yes, those two will be identical.

    While the string manipulation's in the select, that derived column is used in the where, so it's absolutely the same as having the string manipulation in the where.

    Both of these, for example, are not SARGable and will simplify to the same query structure.

    SELECT <columns> FROM SomeTable

    WHERE Substring(SomeColumn,2,3) = 'abc'

    SELECT * FROM (

    SELECT <columns>, Substring(SomeColumn,2,3) as TrimmedString FROM SomeTable

    ) sub

    WHERE sub.TrimmedString = 'abc'

    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