SQL Server General paging stored procedures, with stored procedures can improve efficiency and save time.
SQL Server General paging stored procedures, with stored procedures can improve efficiency and save time.
The Code is as follows:
Create proc
The SQL Server Stored Procedure is paged and supports conditional sorting. For more information, see.
The SQL Server Stored Procedure is paged and supports conditional sorting. For more information, see.
Cs page call code:The Code is as
SQL Server (2005) and later versions are available. Corresponding methods written in the page logic to call the Stored Procedure
SQL SERVER (2005) and later versions are available. Corresponding methods written in the page logic to call the Stored
The simplest net paging Program
CREATE procedure [dbo]. [sp_getPageControl](@ TableNames nvarchar (200), -- table name, which can be multiple tables but cannot be aliases@ PrimaryKey nvarchar (100), -- primary key, which can be null, but this value
DatabaseMetaData information about the entire database: The table name, the index of the table, the name and version of the database product, and the operations supported by the database.ResultSet information about a table or the results of a query.
I. Concept of stored procedureLike C, T-SQL is a structured language.What is a stored procedure?A stored procedure is a set of pre-compiled SQL query statements and control flow statements, and is saved in a database with a specific name. Stored
The code is as follows:Copy code If object_ID ('[proc_SelectForPager]') is not nullDrop Procedure [proc_SelectForPager]GoCreate Proc proc_SelectForPager(@ SQL varchar (max ),@ Order varchar (4000 ),@ CurrentPage int,@ PageSize int,@ TotalCount
Enter n integers to find the smallest number of KSolution 1: Need to modify the input array, based on partition fast sorting to do, time Complex fu O (N)Analysis: Based on the k element of the array to adjust, so that the number of large than the
We all know the gridview in Asp.net. Datalist and so on can all customize pages. However, when you flip pages, all data in the data table will be loaded to the memory and re-bound. Of course, if the data volume is small, this is OK, we are also
Some people often complain on forums, saying:SQL ServerToo much memory. Here I will give a brief introduction to memory-related tuning knowledge based on experience. First, describeSQL ServerWhich parts of memory is used.SQL ServerThe memory
This is my Stored Procedure
Create Procedure [DBO]. [pagination] @ Columns Varchar (500 ), -- The columns to be displayed, divide by comma @ Tablename Varchar (100 ), -- The name of the table to be searched @ Ordercolumnname Varchar (100 ), --
ArticleDirectory
Preface
I. Four Basic SQL statements
Ii. statement execution sequence
4. dynamic SQL statements
Conclusion
Preface
I. Four Basic SQL statements
Ii. statement execution sequence
4. dynamic SQL
An efficient data-paging stored procedure that can easily cope with millions of dataCREATE PROCEDURE pagetest--Test for page flipping--you need to put the sort field in the first column(@FirstID nvarchar (=null),--the value of the sort field for the
Paging Stored Procedure 1 -- Create proc sp_pageview @ tbname sysname in the general paging stored procedure implemented by Top N (converted from external creation), -- Name of the table to be displayed by PAGE @ fieldkey nvarchar (1000 ), -- used
Collection is flexible and contains many convenient classes.
For example, store data in hashTable.Example: Hashtable ht = new Hashtable ();Ht. Add ("white", "1Val ");Ht. Add ("Xiao", "2Val ");Ht. Add ("zhe", "3Val ");Foreach (DictionaryEntry entry
1. Stored Procedure
Create procedure getpagedataoutrowpagecount2
(
@ Pageindex Int = 1, -- current page number
@ Pagesize Int = 10, -- size of each page
@ Rowcount int output, -- total number of rows (outgoing parameter)
@ Pagecount int output --
Create procedure procnameAsDeclare @ recount intSelect @ recount = count (ID) from school
-- The most important sentence isSelect @ recount = count (ID) from schoolSelect @ recount = select count (ID) from school -- error: select is not required
Program codeCreate PROCEDURE pageTest -- used for paging Testing
-- Put the sorting field in the first column
(
@ FirstID nvarchar (20) = null, -- the value of the sorting field of the first record on the current page
@ LastID nvarchar (20) = null, -
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.