{"id":27360,"date":"2023-07-31T06:58:00","date_gmt":"2023-07-31T04:58:00","guid":{"rendered":"https:\/\/expert-only.com\/?p=27360"},"modified":"2023-10-09T08:56:01","modified_gmt":"2023-10-09T06:56:01","slug":"sql-server-pagination","status":"publish","type":"post","link":"https:\/\/expert-only.com\/en\/t-sql\/sql-server-pagination\/","title":{"rendered":"SQL Server Pagination query example using OFFSET and FETCH"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\" id=\"h-learn-how-to-implement-efficient-sql-server-pagination-using-using-the-offset-and-fetch-functions\"><strong><em>Learn how to implement efficient SQL Server pagination using using the OFFSET and FETCH functions.<\/em><\/strong><\/h4>\n\n\n\n<p>SQL Server Pagination query example to better manage batch sizes and performance. Indeed, it is a common requirement in database applications, especially when dealing with large result sets. T-SQL provides two keywords, OFFSET and FETCH, that can be used together to efficiently implement pagination. In this tutorial, we will explore how to use OFFSET and FETCH to achieve efficient pagination in T-SQL.<\/p>\n\n\n\n<p>Before we dive into the code examples, let\u2019s take a moment to understand what OFFSET and FETCH do.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>OFFSET<\/strong>: This keyword specifies the number of rows to skip before starting to return rows from the result set. It allows you to \u201coffset\u201d the starting point of the returned rows.<\/li>\n\n\n\n<li><strong>FETCH<\/strong>: This keyword specifies the number of rows to return after the OFFSET clause. It allows you to limit the number of rows returned.<\/li>\n<\/ul>\n\n\n\n<p>Together, OFFSET and FETCH provide a powerful mechanism to implement pagination in T-SQL. Let\u2019s see now how they can be used in practice.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 ez-toc-wrap-center counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-pagination\/#sql-server-basic-pagination\" >SQL Server Basic Pagination<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-pagination\/#dynamic-pagination-with-variables-for-offset-and-fetch\" >Dynamic pagination with variables for Offset and Fetch<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-pagination\/#sql-server-pagination-combined-with-a-loop\" >SQL Server pagination combined with a loop<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"h-sql-server-basic-pagination\"><span class=\"ez-toc-section\" id=\"sql-server-basic-pagination\"><\/span>SQL Server Basic Pagination<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Suppose we have a table called \u2018Customers\u2019 with columns \u2018CustomerID\u2019, \u2018Name\u2019, and \u2018Email\u2019. We want to retrieve the first 10 customers from the table.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">SELECT\n   [CustomerID],\n   [Name],\n   [Email]\nFROM Customers\nORDER BY CustomerID\n   OFFSET 0 ROWS\n   FETCH NEXT 10 ROWS ONLY;\n<\/pre>\n\n\n\n<p>In this example, we use OFFSET 0 ROWS to start from the first row and FETCH NEXT 10 ROWS ONLY to retrieve the first 10 rows. The result set will contain the CustomerID, Name, and Email columns of the first 10 customers from the table.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-create-the-sample-customers-table-to-use-pagination\">Create the sample Customers table to use pagination<\/h3>\n\n\n\n<p>To create a sample Customers table to use with the SQL Server Pagination examples, use this SQL script. It will create a Customers table with the following columns: <\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>CustomerID<\/li>\n\n\n\n<li>Name<\/li>\n\n\n\n<li>Email<\/li>\n\n\n\n<li>and OrderAmount<\/li>\n<\/ul>\n\n\n\n<p>Then it insert 15 sample records into the table. Of course, you can adjust the sample data or add more records as needed for your pagination examples. And also reuse the code example on your own tables.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">CREATE TABLE dbo.Customers (\n    [CustomerID]  INT PRIMARY KEY,\n    [Name]        NVARCHAR(255),\n    [Email]       NVARCHAR(255),\n    [OrderAmount] DECIMAL(10, 2)\n);\n\n-- This INSERT script adds 15 sample records to the Customers table.\n\nINSERT INTO dbo.Customers (CustomerID, Name, Email, OrderAmount)\nVALUES\n    (1, 'John Doe', 'john.doe@example.com', 100.50),\n    (2, 'Jane Smith', 'jane.smith@example.com', 75.25),\n    (3, 'Bob Johnson', 'bob.johnson@example.com', 120.75),\n    (4, 'Alice Brown', 'alice.brown@example.com', 150.00),\n    (5, 'Charlie Wilson', 'charlie.wilson@example.com', 89.99),\n    (6, 'Eve Anderson', 'eve.anderson@example.com', 200.25),\n    (7, 'David Lee', 'david.lee@example.com', 67.80),\n    (8, 'Grace Turner', 'grace.turner@example.com', 95.60),\n    (9, 'Frank White', 'frank.white@example.com', 110.30),\n    (10, 'Olivia Green', 'olivia.green@example.com', 82.40),\n    (11, 'Sophia Davis', 'sophia.davis@example.com', 135.75),\n    (12, 'William Harris', 'william.harris@example.com', 78.90),\n    (13, 'Ava Martinez', 'ava.martinez@example.com', 160.20),\n    (14, 'James Robinson', 'james.robinson@example.com', 105.10),\n    (15, 'Lily Turner', 'lily.turner@example.com', 95.75);\n<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-dynamic-pagination-with-variables-for-offset-and-fetch\"><span class=\"ez-toc-section\" id=\"dynamic-pagination-with-variables-for-offset-and-fetch\"><\/span>Dynamic pagination with variables for Offset and Fetch<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In some scenarios, you may want to implement pagination dynamically based on user input or application logic. T-SQL allows you to use variables with the OFFSET and FETCH keywords to achieve this. In this specific case, we use the variables <strong><em>@PageNumber <\/em><\/strong>and <strong><em>@PageSize<\/em><\/strong> to determine the offset and fetch values dynamically. The result set will contain the CustomerID, Name, and Email columns of the specified page number and size.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">DECLARE @PageNumber INT = 2; -- User input: page number\nDECLARE @PageSize   INT = 5; -- User input: page size\n\nSELECT\n   [CustomerID],\n   [Name],\n   [Email]\nFROM   Customers\nORDER BY CustomerID\n   OFFSET (@PageNumber - 1) * @PageSize ROWS\n   FETCH NEXT @PageSize ROWS ONLY;\n<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-sql-server-pagination-combined-with-a-loop\"><span class=\"ez-toc-section\" id=\"sql-server-pagination-combined-with-a-loop\"><\/span>SQL Server pagination combined with a loop<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The ultimate goal is to combine OFFSET and FETCH with a loop to go through all the records selected, using the window size selected. Let\u2019s say we want to retrieve all the customers, 5 by 5, ordered by highest order amounts.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">DECLARE @PageNumber INT = 1; -- Starting page number\nDECLARE @PageSize INT = 5; -- Page size\nDECLARE @TotalRows INT; -- Total rows in the Customers table\n\n-- Get the total number of rows in the Customers table\nSELECT @TotalRows = COUNT(*) FROM Customers;\n\nWHILE (@PageNumber * @PageSize &lt;= @TotalRows)\nBEGIN\n    PRINT 'Page ' + CAST(@PageNumber AS NVARCHAR(10));\n\n    SELECT CustomerID, Name, Email, OrderAmount\n    FROM Customers\n    ORDER BY OrderAmount DESC\n    OFFSET (@PageNumber - 1) * @PageSize ROWS\n    FETCH NEXT @PageSize ROWS ONLY;\n\n    SET @PageNumber = @PageNumber + 1;\nEND\n<\/pre>\n\n\n\n<p>In the example above, we use <a href=\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-select-queries-to-filter-data\/\"><strong>the ORDER BY clause in a SELECT query<\/strong><\/a> to sort the result set by the OrderAmount column in descending order. The result set will contain the CustomerID, Name, Email, and OrderAmount columns, displaed in batch of 5 lines, and ordered by the highest order amounts.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h3>\n\n\n\n<p>In this tutorial, we explored how to implement efficient SQL Server pagination with query example for each case explained. Indeed, it is possible using simple T-SQL scripts and the OFFSET and FETCH keywords. Generally speaking, it can be used also in <a href=\"https:\/\/nordicapis.com\/everything-you-need-to-know-about-api-pagination\/\" target=\"_blank\" rel=\"noreferrer noopener\">APIs<\/a>. We learned how to perform basic pagination, dynamic pagination with variables, and pagination with sorting. By utilizing these techniques, you can efficiently retrieve and display large result sets in your T-SQL queries. Remember to optimize your queries and database indexes to further enhance the performance of your pagination implementation.<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>Learn how to implement efficient SQL Server pagination using using the OFFSET and FETCH functions. SQL Server Pagination query example to better manage batch sizes and performance. Indeed, it is a common requirement in database applications, especially when dealing <a class=\"mh-excerpt-more\" href=\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-pagination\/\" title=\"SQL Server Pagination query example using OFFSET and FETCH\">&#8230;<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":10744,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[454],"tags":[],"class_list":{"0":"post-27360","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-t-sql"},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.7 (Yoast SEO v26.2) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>SQL Server Pagination query example using OFFSET and FETCH<\/title>\n<meta name=\"description\" content=\"Use one of the OFFSET and FETCH pagination query example commands to display SQL Server rows in consistent batch sizes.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-pagination\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SQL Server Pagination query example using OFFSET and FETCH\" \/>\n<meta property=\"og:description\" content=\"Use one of the OFFSET and FETCH pagination query example commands to display SQL Server rows in consistent batch sizes.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-pagination\/\" \/>\n<meta property=\"og:site_name\" content=\"SQL and IT Tutorials\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ExpertOnlyCom\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-31T04:58:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-10-09T06:56:01+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/macro-1452987_1920x1080.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1080\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Expert-Only\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@expert_only\" \/>\n<meta name=\"twitter:site\" content=\"@expert_only\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Expert-Only\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-pagination\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-pagination\/\"},\"author\":{\"name\":\"Expert-Only\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef\"},\"headline\":\"SQL Server Pagination query example using OFFSET and FETCH\",\"datePublished\":\"2023-07-31T04:58:00+00:00\",\"dateModified\":\"2023-10-09T06:56:01+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-pagination\/\"},\"wordCount\":595,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/expert-only.com\/en\/#organization\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-pagination\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/macro-1452987_1920x1080.jpg\",\"articleSection\":[\"T-SQL\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-pagination\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-pagination\/\",\"url\":\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-pagination\/\",\"name\":\"SQL Server Pagination query example using OFFSET and FETCH\",\"isPartOf\":{\"@id\":\"https:\/\/expert-only.com\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-pagination\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-pagination\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/macro-1452987_1920x1080.jpg\",\"datePublished\":\"2023-07-31T04:58:00+00:00\",\"dateModified\":\"2023-10-09T06:56:01+00:00\",\"description\":\"Use one of the OFFSET and FETCH pagination query example commands to display SQL Server rows in consistent batch sizes.\",\"breadcrumb\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-pagination\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-pagination\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-pagination\/#primaryimage\",\"url\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/macro-1452987_1920x1080.jpg\",\"contentUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/macro-1452987_1920x1080.jpg\",\"width\":1920,\"height\":1080},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-pagination\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"en\",\"item\":\"https:\/\/expert-only.com\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SQL Server Pagination query example using OFFSET and FETCH\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/expert-only.com\/en\/#website\",\"url\":\"https:\/\/expert-only.com\/en\/\",\"name\":\"SQL and IT Tutorials\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/expert-only.com\/en\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/expert-only.com\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/expert-only.com\/en\/#organization\",\"name\":\"Expert-Only\",\"url\":\"https:\/\/expert-only.com\/en\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg\",\"contentUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg\",\"width\":381,\"height\":174,\"caption\":\"Expert-Only\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/ExpertOnlyCom\/\",\"https:\/\/x.com\/expert_only\",\"https:\/\/www.youtube.com\/channel\/UCMS5sR_FwAetB0FmciNvUaA\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef\",\"name\":\"Expert-Only\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g\",\"caption\":\"Expert-Only\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"SQL Server Pagination query example using OFFSET and FETCH","description":"Use one of the OFFSET and FETCH pagination query example commands to display SQL Server rows in consistent batch sizes.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/expert-only.com\/en\/t-sql\/sql-server-pagination\/","og_locale":"en_US","og_type":"article","og_title":"SQL Server Pagination query example using OFFSET and FETCH","og_description":"Use one of the OFFSET and FETCH pagination query example commands to display SQL Server rows in consistent batch sizes.","og_url":"https:\/\/expert-only.com\/en\/t-sql\/sql-server-pagination\/","og_site_name":"SQL and IT Tutorials","article_publisher":"https:\/\/www.facebook.com\/ExpertOnlyCom\/","article_published_time":"2023-07-31T04:58:00+00:00","article_modified_time":"2023-10-09T06:56:01+00:00","og_image":[{"width":1920,"height":1080,"url":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/macro-1452987_1920x1080.jpg","type":"image\/jpeg"}],"author":"Expert-Only","twitter_card":"summary_large_image","twitter_creator":"@expert_only","twitter_site":"@expert_only","twitter_misc":{"Written by":"Expert-Only","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/expert-only.com\/en\/t-sql\/sql-server-pagination\/#article","isPartOf":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/sql-server-pagination\/"},"author":{"name":"Expert-Only","@id":"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef"},"headline":"SQL Server Pagination query example using OFFSET and FETCH","datePublished":"2023-07-31T04:58:00+00:00","dateModified":"2023-10-09T06:56:01+00:00","mainEntityOfPage":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/sql-server-pagination\/"},"wordCount":595,"commentCount":0,"publisher":{"@id":"https:\/\/expert-only.com\/en\/#organization"},"image":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/sql-server-pagination\/#primaryimage"},"thumbnailUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/macro-1452987_1920x1080.jpg","articleSection":["T-SQL"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/expert-only.com\/en\/t-sql\/sql-server-pagination\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/expert-only.com\/en\/t-sql\/sql-server-pagination\/","url":"https:\/\/expert-only.com\/en\/t-sql\/sql-server-pagination\/","name":"SQL Server Pagination query example using OFFSET and FETCH","isPartOf":{"@id":"https:\/\/expert-only.com\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/sql-server-pagination\/#primaryimage"},"image":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/sql-server-pagination\/#primaryimage"},"thumbnailUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/macro-1452987_1920x1080.jpg","datePublished":"2023-07-31T04:58:00+00:00","dateModified":"2023-10-09T06:56:01+00:00","description":"Use one of the OFFSET and FETCH pagination query example commands to display SQL Server rows in consistent batch sizes.","breadcrumb":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/sql-server-pagination\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/expert-only.com\/en\/t-sql\/sql-server-pagination\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/expert-only.com\/en\/t-sql\/sql-server-pagination\/#primaryimage","url":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/macro-1452987_1920x1080.jpg","contentUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/macro-1452987_1920x1080.jpg","width":1920,"height":1080},{"@type":"BreadcrumbList","@id":"https:\/\/expert-only.com\/en\/t-sql\/sql-server-pagination\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"en","item":"https:\/\/expert-only.com\/en\/"},{"@type":"ListItem","position":2,"name":"SQL Server Pagination query example using OFFSET and FETCH"}]},{"@type":"WebSite","@id":"https:\/\/expert-only.com\/en\/#website","url":"https:\/\/expert-only.com\/en\/","name":"SQL and IT Tutorials","description":"","publisher":{"@id":"https:\/\/expert-only.com\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/expert-only.com\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/expert-only.com\/en\/#organization","name":"Expert-Only","url":"https:\/\/expert-only.com\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/","url":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg","contentUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg","width":381,"height":174,"caption":"Expert-Only"},"image":{"@id":"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/ExpertOnlyCom\/","https:\/\/x.com\/expert_only","https:\/\/www.youtube.com\/channel\/UCMS5sR_FwAetB0FmciNvUaA"]},{"@type":"Person","@id":"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef","name":"Expert-Only","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/expert-only.com\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g","caption":"Expert-Only"}}]}},"_links":{"self":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/27360","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/comments?post=27360"}],"version-history":[{"count":32,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/27360\/revisions"}],"predecessor-version":[{"id":27547,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/27360\/revisions\/27547"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media\/10744"}],"wp:attachment":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media?parent=27360"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/categories?post=27360"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/tags?post=27360"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}