Copy codeThe Code is as follows:Set ANSI_NULLS ONSet QUOTED_IDENTIFIER ONGoCreate PROCEDURE [dbo]. [SP_Pagination]/**//***************************************** ************************* Tens of millions of paging stored procedures ******************
The two paging stored procedures used in the previous section can be referenced by friends who need them.
The two paging stored procedures used in the previous section can be referenced by friends who need them.
First, get the total number of data
Http://focus755.com/article5.asp? Article _id = 956
Set quoted_identifier onGoSet ansi_nulls onGo
Create procedure sh_page/***************************************** ************************* There are tens of millions of paging stored procedures in
/* -- The method for resolving strings that cannot exceed 8000
It is often mentioned that when data is processed using the dynamic generation of SQL statements, the processing statements are too long and cannot be processed.This issue is discussed
Address: http://www.cnblogs.com/qq731109249/archive/2012/10/23/2736278.html
In the actual development process, if the number of records is very large, it would be terrible to query and fill the data table with SQL statements directly. In addition,
There are two Repeated Records. One is a completely repeated record, that is, records with all fields being repeated, and the other is records with duplicate key fields, such as duplicate name fields, other fields are not necessarily repeated or can
Iii. General paging display and storage process for small data volumes and massive data
Creating a web application requires paging. This problem is very common in database processing. The typical data paging method is the ADO record set paging
Address: http://www.cnblogs.com/nosnowwolf/archive/2008/07/22/1248796.html
Http://blog.csdn.net/wanglong7505/archive/2010/01/16/5193085.aspx
The effect is as follows:
CodeThe implementation is as follows:
Namespace windowsapp. mycontrol{/**
Original article: http://support.microsoft.com/kb/139444/SummaryThe Microsoft SQL Server table should not contain duplicate rows and non-unique primary keys. For the sake of conciseness, we sometimes refer to the primary key as "key" or "Pk" in this
In. net, although the gridview, DataGrid, and other controls provide the paging function, when the data capacity in the data table is too large, this method is obviously not suitable for paging, too much data will make the page very large, this may
Method 1
CopyCode The Code is as follows: declare @ Max integer, @ ID integer
Declare cur_rows cursor local for Select Main field, count (*) from table name group by main field having count (*)> 1
Open cur_rows
Fetch cur_rows into @ ID, @
For example:
ID name value
1 A PP
2 A PP
3 B III
4 B PP
5 B PP
6 c pp
7 c pp
8 C III
ID is the primary key
This result is required.
ID name value
1 A PP
3 B III
4 B PP
6 c pp
8 C III
Method 1
Delete yourtable
Where [ID] Not in (
Select max ([ID])
CopyCode The Code is as follows: Set ansi_nulls on
Set quoted_identifier on
Go
Create procedure [DBO]. [sp_pagination]/**//***************************************** ************************* Tens of millions of paging stored procedures ***********
Row_number () stored procedure page
In the new SQL Server 2005 method row_number, make a query selectRow_number ()Over (order by productid) as row, name from product you can see that each record in the returned result has a unique identifier
Method 1
Copy codeThe Code is as follows: declare @ max integer, @ id integer
Declare cur_rows cursor local for select Main field, count (*) from table name group by main field having count (*)> 1
Open cur_rows
Fetch cur_rows into @ id, @ max
While
Set ANSI_NULLS ONSet QUOTED_IDENTIFIER ONGo
Alter procedure [dbo]. [SP_Pagination]
/***************************************** ************************* Tens of millions of paging stored procedures ****************************************** ********
In the actual development process, if the number of records is very large, it would be terrible to query and fill the data table with SQL statements directly. In addition, the website performance and server performance are greatly consumed.
Two
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.