Link to home
Start Free TrialLog in
Avatar of ferik
ferikFlag for India

asked on

How can i fix execution plan of stored procedure or user defined function in SQL Server 2005

I have SQL Server 2005. I want to know how can i fix and change execution plan of stored procedure or user defined function?

Also, want to know, if already I fix excution plan, when automatically it gets changed, and what to do to avoid it.

I have stored procedure, which run several times in an hour (lets say 500-800 times in an hour), i have observered that execution plan gets changed frequently. So, if i can fix execution plan, than i can take maximum advantage of indexes i created.
Avatar of chapmandew
chapmandew
Flag of United States of America image

to change the execution plan, you'll need to either change the query OR include query and/or join hints.  You can also use plan guides

post your procedure code.
Avatar of ferik

ASKER

I have attached procedure code. basically this procedure works like notification to different application to find out further steps require to take or not.

Please advice.

Proc.txt
ASKER CERTIFIED SOLUTION
Avatar of chapmandew
chapmandew
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ferik

ASKER

Yes, there are indexes on all those fields. Please note that all indexes are seperate. No index has more than 1 column.