Hi Krishna,
There is no total calculation for the specific query. I'm more interested in why calling the code in a stored procedure is always much slower than running the select statement directly.
WRT to your Analytic View statement, how would wrap the analytic view call in a sqlscript procedure?
Regards,
Bill