SELECT TOP (1000) [DBName]
,[TableName]
,[Reportdate]
,[ActionID]
,[Records]
,[DateCreated]
FROM [PXYZ_database].[dbo].[SystemData]
因此,从上面的上述查询中,我想使其选择44000和45000的行范围。我试图以这种方式编写查询,但是到目前为止,它非常复杂。
SELECT * FROM table limit 100 [DBName]
,[TableName]
,[Reportdate]
,[ActionID]
,[Records]
,[DateCreated]
FROM [PXYZ_database].[dbo].[SystemData]
但是我收到错误消息,语法错误吗?
答案 0 :(得分:0)
您可以将order by
子句与offset
选项一起使用:
SELECT [DBName]
,[TableName]
,[Reportdate]
,[ActionID]
,[Records]
,[DateCreated]
FROM [PXYZ_database].[dbo].[SystemData]
ORDER BY [DBName] OFFSET 44000 ROWS FETCH NEXT 1000 ROWS ONLY