• devaji123 (2/12/2013)


    Try this way, comment the create procedure line using declare give values to the parameters and run it as query and now you can check the place where you made changes and execute the temp tables and the logic query on the same query tab in such way you can know which query is taking more time and why.

    The other way is use SQL profiler.

    Just know that if you're passing values to the parameters locally, as variables, it changes the way the procedure will be resolved because the optimizer will not be able to sniff the local variables in the same way it can parameters. In general, I wouldn't recommend this approach. Just call the procedure and pass it the parameters you want.

    "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