January 21, 2011 at 11:07 am
My apologies, I didn't mean to be a jerk. I intented to give a strong vote to not do something so huge with cursors, which are much slower most of the time anyways.
January 22, 2011 at 2:38 am
Ninja's_RGR'us (1/21/2011)
CELKO (1/21/2011)
You better off doing the running totals in the front end in T-SQL. Do you have a report writer of some kind?In Standard SQL there is an optional [ROWS|RANGE] clasue that does this beautifully, but we don't have it in the lesser SQLs:
SUM(sales_amt)
OVER (PARTITION BY dept_nbr
ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)
AS sale_amt_running_tot
Hmm I can't seem to make this work. Do you have a working exemple?
This isn't supported by SQL Server (yet) and has been requested here
____________________________________________________
Deja View - The strange feeling that somewhere, sometime you've optimised this query before
How to get the best help on a forum
http://www.sqlservercentral.com/articles/Best+Practices/61537Viewing 2 posts - 16 through 17 (of 17 total)
You must be logged in to reply to this topic. Login to reply