我不知道这段代码有什么问题,它现在给了我一天的错误:
select row_number() over(order by s.title) as rowNumber, s.id
from story as s
表定义:
id bigint
title nvarchar(100)
content ntext
数据库:SQL Server Compact 4.0.8482.1
错误:
There was an error parsing the query. [ Token line number = 1,Token line offset = 22,Token in error = over ]
到目前为止我做了什么:
我在这里搜索了同样的问题,但该解决方案不适用于我的,我需要
row_number
功能这么差。
最佳答案
正如 ErikEJ 已经提到的 - ROW_NUMBER
在 SQL Server Compact Edition 中根本不存在 - 即使在最新的 4.0 版本中也不存在。
但是,如果您尝试使用 ROW_NUMBER
为了分页您的数据,SQL Server Compact Edition 4.0 确实支持通过 SQL Server 2012 中将出现的新关键字进行服务器端分页 - 参见 this blog post here了解所有细节。
你应该能够写出类似的东西:
SELECT (columns)
FROM Story s
ORDER BY Title
OFFSET 20 ROWS
FETCH NEXT 10 ROWS ONLY;
关于sql-server-ce - SQL Server CE - ROW_NUMBER,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8699955/