I am executing the following query;
CREATE TABLE #temp_c
(
row_id NUMERIC(18) IDENTITY (1,1),
value NUMERIC(18)
)
INSERT #temp_c (value)
VALUES (1), (7), (10), (1), (12), (8), (6), (3)
SELECT
row_id,
value,
SUM(value) OVER (ORDER BY row_id) total
FROM
#temp_c
DROP TABLE #temp_c
And expect the following results
row_id value total
--------------------------------------- --------------------------------------- ---------------------------------------
1 1 1
2 7 8
3 10 18
4 1 19
5 12 31
6 8 39
7 6 45
8 3 48
When executing this code on SQL Server 2012 the above query functions as expected.
When executing this code on SQL Server 2008 R2 the query returns the following error
Msg 102, Level 15, State 1, Line 17
Incorrect syntax near 'order'.
According to this documentation I should be able to start using this query in 2008.
Please note the PARTITION BY syntax works on both versions, was the ORDER BY logic implemented at a later date?