• One thing that may speed it up is the following:

    When possible, use isnull rather than the case statement.

    According to the execution plan, it is twice as fast.

    ie.

    replace this:

    CASE WHEN @Country IS NOT NULL THEN @Country ELSE Country END

    with:

    isnull(@Country,Country)

    additionally:

    You may want to put your top 3000 select statements into temporary tables and join on them rather than putting them in the where clause.

    I'm not sure about this, but I think that sometimes the select top 3000 may be executed for every row that is returned???? Maybe not. I guess it depends upon how well the execution plan can interpret the query? Anybody have any knowledge about this?

    -J