• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 189
  • Last Modified:

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.
0
ferik
Asked:
ferik
  • 2
  • 2
1 Solution
 
chapmandewCommented:
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.
0
 
ferikAuthor Commented:
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
0
 
chapmandewCommented:
Are there indexes on the LCode, BID,SID and stID fields?
0
 
ferikAuthor Commented:
Yes, there are indexes on all those fields. Please note that all indexes are seperate. No index has more than 1 column.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now