简体   繁体   English

查询分页的mssql数据库返回错误

[英]query for pagination for mssql database return an error

I m try create query for pagination 我尝试创建分页查询

this is the query. 这是查询。

SELECT * FROM
 ( SELECT *, ROW_NUMBER() OVER (ORDER BY [TEST].[dbo].[Registration]. 
 [RegistrationNo] as row 
 FROM [TEST].[dbo].[Registration] ) a 
WHERE row > 5 and row <= 10

when i try to run this query on microsoft sql server studio, it return an error saying that 当我尝试在Microsoft sql Server Studio上运行此查询时,它返回一条错误消息,指出

Msg 156, Level 15, State 1, Line 1 Incorrect syntax near the keyword 'as'. 消息156,级别15,状态1,第1行关键字'as'附近的语法错误。

  • TEST was database name TEST是数据库名称
  • dbo.Registration is table name dbo.Registration是表名
  • dbo.Registration.RegistrationNo is Primary key Column for table dbo.Registration dbo.Registration.RegistrationNo是表dbo.Registration的主键列

is this information enough to detect the problem?, or should i provide query for create Registration table? 此信息足以检测到问题吗?还是我应该为创建注册表提供查询?

Missing ) after order by 订购后缺少)

SELECT * FROM ( SELECT *, ROW_NUMBER() OVER (ORDER BY [TEST].[dbo].[Registration].[RegistrationNo]) as row 
FROM [TEST].[dbo].[Registration] ) a 
WHERE row > 5 and row <= 10

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM