• lucassouzace (1/22/2009)


    ok, but this example, the query using union all more better union do you think ?

    In your specific example, because there are no overlaps (rows in more than one of the resultsets) union all is better as it won't require a distinct sort. In general, it depends on whether or not there's a chance of overlapping rows and, if there is a chance, if you want the duplicates removing or not.

    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