mercredi 24 février 2016

alternative to "rows UNBOUNDED PRECEDING" on sql server 2005

I am working on a conversion of a series of teradata statament to sql-server 2005. everything ok untill we met this :

select CODE, _year, _month, _day, product,
sum(DAILY_AMMOUNT) over(partition by CODE, _year, _month ,product order by _day ROWS UNBOUNDED PRECEDING) as DAY_AMM 
from ...

as you for sure know there is no ROWS in sql-server 2005.

I know that in some cases I could replace it with RANGE, but I don't have access to the teradata database to check if this is indeed the case. Any idea on how i can replace the sum to be sure that the result will be matching?

Thanks in advance

Aucun commentaire:

Enregistrer un commentaire