General SQL stored procedure paging and asp.net background call methods, stored procedure asp.net
Create a table and add 3 million data
Use StoredCREATE TABLE UserInfo (-- Create TABLE id int IDENTITY () primary key not null, -- add primary key and
I would like to share with you the most efficient paging query: 50 million levels, which is more efficient than ROWNUMBER and Top.
I would like to share with you the most efficient paging query: 50 million levels, which is more efficient than
Connection string
The code is as follows:
String conn = configurationmanager.connectionstrings["NorthwindConnectionString"]. ConnectionString;
Confige fileThe code is as follows:
1. A stored procedure that returns only a single
1. Start the restore below first look at the original paging stored procedures.
Copy Code code as follows:
ALTER PROCEDURE [dbo]. [Sp_sql_paging]
(
@SqlDataTable NVARCHAR (4000),--table name
@PrimaryKey NVARCHAR (4000),--primary Key
Copy Code code as follows:
/*
Date: 2009-03-19
Function: Get the Game country task list data according to various conditions
*/
Create procedure [dbo]. [Prgs_nation_task_getlist]
@PageSize int = 100--Displays the number of record bars
Parameters for the output type need to be added in the parameter list of the stored procedure. Parameters of the output type pass in the stored procedure and return their running values.
Parameters for the return value type do not need to be
Create procedure [dbo]. [Prgs_nation_task_getlist]@PageSize int = 100--Displays the number of record bars per page, defaults to 100@PageIndex int = 1,--current fetch page number to display, default is 1, database returns one page of data based on
Requirements: The table name is dynamic, it must be executed with exec, and then the variable is dynamically assigned to the exec.EXEC (' Select @count =count (empid) from ' [email protected]+ ' where proid= ' [email protected]+ ' and idThe code
Http://www.cnblogs.com/goody9807/archive/2010/10/19/1855697.htmlDynamic SQL statement Basic syntax1: Normal SQL statements can be executed with execEg:select * from TableNameExec (' select * from TableName ')Exec sp_executesql n ' select * from
Strictly speaking, these three production methods have certain intersections, and their positioning methods will be explained below
Strictly speaking, these three production methods have certain intersections, and their positioning methods will be
Copy codeThe Code is as follows:/*Date: 2009-03-19Function: obtains national game task list data based on various conditions.*/Create procedure [dbo]. [PrGs_Nation_Task_GetList]@ PageSize int = 100, -- the number of records displayed on each page.
The database in this article uses the SQL server's built-in data Northwind.
Connection string:
String conn = ConfigurationManager. ConnectionStrings ["NorthwindConnectionString"]. ConnectionString;
Confige file:
1. Only the stored
C # detailed description of calling a stored procedure,
The database in this article uses the SQL server's built-in data Northwind.
Connection string:
String conn = ConfigurationManager. ConnectionStrings ["NorthwindConnectionString"].
Complete example of MSSQL paging Stored Procedure (supporting multi-Table paging storage), mssql Stored Procedure
This example describes the paging Stored Procedure of MSSQL. We will share this with you for your reference. The details are as follows:
The following is a reference for a friend who needs to paging the mssqlserver stored procedure written by a netizen.
The following is a reference for a friend who needs to paging the mssqlserver stored procedure written by a netizen.
Connection string
Copy codeThe Code is as follows:String conn = ConfigurationManager. ConnectionStrings ["NorthwindConnectionString"]. ConnectionString;
Confige File Copy codeThe Code is as follows: 1. Only the stored procedure of a single record
The database for this article uses SQL Server's own data NorthwindConnection string:String conn = configurationmanager.connectionstrings["NorthwindConnectionString"]. ConnectionString;Confige file:1. A stored procedure that returns only a single
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.