I'm trying to write a report from pulling data from several sources and have managed to write a query that gets me towards what I need.
However, when I tried to convert this into a stored procedure
the execution time rocketed from 0-2 secs to 3-4 mins!
I've narrowed this down to the effect of replacing literal strings with variables.
(i.e WAS "between '06/06/03 00:00' and '06/10/03 23:59'"
is now "between @StartDate and @Removedate"
Any ideas how i can work around this?
However, when I tried to convert this into a stored procedure
the execution time rocketed from 0-2 secs to 3-4 mins!
I've narrowed this down to the effect of replacing literal strings with variables.
(i.e WAS "between '06/06/03 00:00' and '06/10/03 23:59'"
is now "between @StartDate and @Removedate"
Any ideas how i can work around this?