I have recenty began following Microsoft SQL Server 2012 T-SQL Fundamental book to learn T-SQL. The following query I tried executing in SQL Server 2008 r2
SELECT empid, ordermonth, val,
SUM(val) OVER(PARTITION BY empid
ORDER BY ordermonth
ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS runval
FROM Sales.EmpOrders;
the query fails to execute with the following error message
Msg 102, Level 15, State 1, Line 5
Incorrect syntax near 'ROWS'.
this is the fragment of sales.emporders view
empid ordermonth qty val numorders
-----------------------------------------------------------------
5 2007-10-01 00:00:00.000 361 7581.33 9
6 2007-06-01 00:00:00.000 173 3464.81 7
9 2007-09-01 00:00:00.000 93 8776.15 5
5 2008-02-01 00:00:00.000 276 5377.06 15
5 2007-07-01 00:00:00.000 213 6475.40 5
4 2006-10-01 00:00:00.000 613 13718.97 27
Need help in figureing out a work around for sql server 2008 r2