I have a Stored Procedure whitch has two input parameters. Both are integer. The body of this procedure is a SELECT with 4 inner joins.
When I execute the SP it spend 20 seconds and return 23 rows of my database.
Therefore, if I copy the SELECT and I execute it directly in the SQL Query analyzer (setting the parameters values manually) it spends only 1 second and return the same.
I need to use the SP but I can't improve it. Could somebody help me?
New here so don't know the rules and regulations regarding posting code but we really need to see some.
The stored procedure sounds like it's okay, so your client code may be the problem, but we would need to see it first to be sure...