Row_Number() over 2 billion records (Teradata)

▼魔方 西西 提交于 2020-01-24 09:50:08

问题


I am working with a Teradata warehouse, and I am using row_number in one of my sql scripts. The record set I am trying to use my script on is larger than the maximum of the integer value threshold. What to do in such a situation?

(casting the "row_number() over (par..)" expression to bigint did not work)

If you have found a solution for this problem in another DBMS, then I also welcome your solution as it might work in Teradata too.


回答1:


It is possible that just casting the value would work.

If not, try this:

select sum(cast(1 as bigint)) over (order by . . . Rows Unbounded Preceding)

Or, alternatively,

select csum(cast(1 as bigint), <order by column here>)


来源:https://stackoverflow.com/questions/16173192/row-number-over-2-billion-records-teradata

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!