I have some SQL code I wrote that returns about 15,000 rows (using a
group by statement, raw data is around 1mill rows). In this code I
have a few variables that I declare and set. These variables for the
most part are just calling functions that return a set value that I
use later in my script in Where statements. The script runs in about
11sec and all the data looks good.
Now I would like to create a view with this script, my ultimate goal
here is to have Excel call the view for an end user that will update
whenever they want. I want to make it as easy as possible on them.
So my question is, is there any way that I can do this?
Now I can certainly just replace all of my variables. However because
of the way that SQL works and the way that I have the script
constucted it fires the functions 1 time each then just uses the
result, if I replace all the variables with the functions it has to
fire the functions around 1mill times each. These functions were
written by someone else and they work but I do find them slow.
Consequently the time to run the script jumps from 11sec to over 15min.