简体   繁体   中英

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

Msg 156, Level 15, State 1, Line 1 Incorrect syntax near the keyword 'as'.

  • TEST was database name
  • dbo.Registration is table name
  • dbo.Registration.RegistrationNo is Primary key Column for table 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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