Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Implementation of stored procedure code sharing for SQL paging

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "the realization of SQL paging stored procedure code sharing". In daily operation, I believe that many people have doubts about the realization of SQL paging stored procedure code sharing. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "realizing SQL paging stored procedure code sharing". Next, please follow the editor to study!

SQL paging stored procedure code, friends who need to directly use, the use is very simple.

The sharing code is as follows

USE [SendMessage] GO/* Object: StoredProcedure [dbo]. [pages] Script Date: 07Univer 13:46:50 * / SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOALTER PROC [dbo]. [pages] (@ tbname nvarchar (1000)-- Table name to be paged @ FieldKey nvarchar (100)-- the primary key (unique key) field used to locate the record, which can be multiple fields separated by commas @ PageCurrent int=1 -- page number to display @ PageSize int=10,-- size per page (number of records) @ FieldShow nvarchar (1000) ='',-- comma-separated list of fields to display, if not specified, all fields @ FieldOrder nvarchar (1000) ='',-- comma-separated sorted list of fields You can specify DESC/ASC@WhereString nvarchar (1000) = query'- query condition) ASbegin IF ISNULL (@ FieldKey,N'') = 'BEGIN RAISERROR (N' paging requires primary key (or unique key)', RETURNEND IF ISNULL (@ PageCurrent,0) after the field.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report