3 Ways to paging SQL Server are as follows:
---SQL Server 2005-page statement collection
----Disadvantages:
Top: Complex SQL must be written by the user and no composite primary key is supported
Max: Users must write complex SQL and do not support non-unique column sorting
--row: sqlserver2000 not supported
--------------------------------
Id,email,qq,wech
The main use of Jsqlparser, in front of a blog introduced:Java-sql Parsing tool Jsqlparser simple to useIn order to add support for SQL Server to the MyBatis page plug-in, this is a standalone tool that relies only on jsqlparser.This class is not only for the page plug-in to use, he can also use independently, using it you can easily generate a paging query.Paging Plugin Address: Mybatis_pagehelperSQL
Tags: Database SQL Server Stored procedure pagingRecently, in the interview, met a wonderful bald old man interview officer.Q: Have you ever written a stored procedure paging?A: not written, but I know the principle of paging storage, I wrote it myself, just did not write at work.Q: So you haven't written in your work for so many years?A: I did not write it, beca
Www. webdiyer. comControlsAspNetPagerSpGenerator generate SQLSEVER2005 and later versions of SQLServer paging storage process: alias (@ projectIDnvarchar (50), @ pagesizeint, @ pageindexint, @ docountbit) asif (@ docount1)
Http://www.webdiyer.com/Controls/AspNetPager/SpGenerator generation SQL Server paging Stored procedure SQL SEVER 2005 and later versions: crea
Comparison of paging stored procedures and performance of five types of SQL Server, SQL stored procedures
In SQL Server database operations, we often use stored procedures to implement paging processing of the queried data to facilitate browsing by viewers. This article summarizes the five
Normally, an appropriate index is established on the SQL Server server for a table with a high frequencyThis can greatly improve the data retrieval speed of the database itself, the method of establishing the index is not elaborateIf you need to return a large amount of data, from hundreds of lines to tens of thousands of rows, or even hundreds of thousands of rows of dataYou will find that the response tim
value is greater than the record of the maximum ID value for the first 40 records.This query has one condition, that is, the ID must be of type int.The third method:Select Top Ten * from ( Selectover (order by as RowNumber,* from test) Awhere>Principle: First sort all the data in the table according to a rownumber, then query rownuber more than 40 of the first 10 recordsThis approach is similar to a paging method in Oracle, but only supports ver
million data, 10 data per page, 20,000 pages, 150,000 pages and 320,000 pages were tested. Page number, top scheme, max scheme, row scheme 20,000, 60MS,46MS,33MS15, 453ms,343ms,310ms32, 953ms,720ms,686ms is a paging scheme for splicing SQL statements through programs, User-mentioned SQL statements do not need to write complex SQL logic user provides SQL code as followsSelect* fromtable1 starting with 5th, Query 5, post-processing SQL into SQL codeSel
In section 2005, we have more options. We can use the new syntax CTE (Public table expression). The paging stored procedures include the following:
1. Use Not in and select top
2. Use the value of id greater than or select top
3. Use the cursor in SQL
4. Temporary table
See the following link on the Internet.
Summary of commonly used paging stored procedures in C #Http://read.newbooks.com.cn/info/174545.ht
1. IntroductionToday at work encountered a need to do SQL Server paging data query, but the paging data query SQL has forgotten, and finally through the query data to solve the problem. Now make a note of the solution and prepare it for review.Here you need to thank the Qlin of the blog Park2. Data paging statementsSup
server|sqlserver| Stored Procedures | Paging one of my ASP + SQL Server paging programs: The feature of this program is to drop the current page record on the page. Good performance, and do not use stored procedures, because the code is not encapsulated, so very fragmented, to use your program, you need to read the fir
In SQL Server database operations, we often use stored procedures to implement the query data paging to facilitate the browsing of the viewer.
To create a database data_test:
Create DATABASE data_test go use
data_test go create table
tb_testtable --Creating Tables
(
ID int Identity (1,1) primary key,
userName nvarchar not null,
userpwd nvarchar (.) not NULL,
UserEmail nvarchar () nul
The paging stored procedure for SQL Server 2005 is divided into 3 versions, one that has not been optimized, one that is optimized, the last to support join, the SQL Server 2000 paging stored procedure, or run on SQL Server 2005, but the performance is not SQL The version of
Tags: primary key style COM using IDE online strong. NET roughlyBack-end projects developed at hand have been using the. NET MVC framework, access to the database using its own EF Codefirst model, and the ability to write stored procedures is rapidly deteriorating Free to do nothing, I wrote a page of stored procedures, similar articles on the Internet, there is only one case, based on the analysis function to generate line numbers to achieve paging q
= @recordCount/@pageSize + 1--Total pages equals total number of records divided by page size plus 1Set @totalCount = @recordCountSET NOCOUNT off;End--Execute the stored procedure in the databasedeclare @pageCount int, @totalCount intexec proc_page_withtopmax 2,95955, @pageCount output, @totalCount outputSelect ' Total pages: ' +str (@pageCount)Select ' Total number of bars: ' +str (@totalCount)C # code calls the paging stored procedure with input an
Label:the following SQL is a general-purpose paging stored procedure in server: If (exists (SELECT * FROM sys. procedures where name= ' proc_paging '))--if proc_paging This stored procedure exists drop proc Proc_pagi ng--then delete this stored procedure go to create proc proc_paging ( @pageSize nvarchar (), nbsp; @currentPage nvarchar, @tablename nvarchar ( @orderbycolumn nvarchar (), @ Wherewithand n
keysRow: sqlserver2000 not supported Test data:A total of 3.2 million data, each page shows 10 data, respectively, 20,000 pages, 150,000 pages and 320,000 pages were tested. Page number, top scheme, max scheme, row scheme20,000, 60MS,46MS,33MS150,000, 453ms,343ms,310ms320,000, 953ms,720ms,686ms is a paging scheme that uses a program to stitch SQL statements.User-mentioned SQL statements do not need to write complex SQL logic The user provides SQL as
Five paging stored procedures based on SQL Server and Performance Comparison
In SQL Server database operations, we often use stored procedures to implement paging processing of the queried data to facilitate browsing by viewers.
Create a database data_Test:
Create database data_Test GO use data_Test GO create table tb_
Label:Recently have been looking at SQL Server books, but look at the basic query flow, query in the work of the most, so it is important to correctly query the desired data. See in the book in SQL Server 2012 a new implementation of paging Query method, feel more convenient than the original, so record, if can help everyone, is very happy ~ Before
In SQL Server database operations, we often use stored procedures to implement the query data paging to facilitate the browsing of the viewer. In this article, we summarize the methods of five SQL Server paging stored procedures and compare their performance, so let's take a look at this process together.
To create a
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.