Sql Query takes too long in stored proc

Found this issue when a stored procedure was taking it too long to execute and the same query inside the proc took fraction of a second. Never seen this before did some searching and found a simple fix. Add option (recompile) at the end of the query and voila problem resolved.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: