1.分页提取数据,偏移2个,每页3个。
--select * FROM Person
--where Age > 18
--ORDER BY id -- 必须有orderby,否则报错
--offset 2 rows fetch next 3 rows only
2.游标方式
https://learn.microsoft.com/zh-cn/sql/t-sql/language-elements/declare-cursor-transact-sql?view=sql-server-ver16
ISO Syntax
DECLARE cursor_name [ INSENSITIVE ] [ SCROLL ] CURSOR
FOR select_statement
[ FOR { READ ONLY | UPDATE [ OF column_name [ ,...n ] ] } ]
[;]
Transact-SQL Extended Syntax
DECLARE cursor_name CURSOR [ LOCAL | GLOBAL ]
[ FORWARD_ONLY | SCROLL ]
[ STATIC | KEYSET | DYNAMIC | FAST_FORWARD ]
[ READ_ONLY | SCROLL_LOCKS | OPTIMISTIC ]
[ TYPE_WARNING ]
FOR select_statement
[ FOR UPDATE [ OF column_name [ ,...n ] ] ]
[;]
--Declare curlscroll CURSOR scroll --FOR select * --FROM Person --where Ahe > 18 --ORDER BY id FETCH last from curlStatic; select 'next_fetch执行情况'=@@FETCH_STATUS Select @@CURSOR_ROWS
https://blog.csdn.net/lin_lujian/article/details/6914230
标签:提取,name,--,游标,CURSOR,sql,select,分页 From: https://www.cnblogs.com/kingsmart/p/16879814.html