• And when you make the query into a procedure as Paul says, make the parameters NOT NULL and the users will have to supply them.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning