I. Preface1. Description of Compiler optimizations:Because memory access is far less than CPU processing speed, in order to improve the overall performance of the machine, hardware to introduce hardware cache caches, speed up the access to memory.
I. Preface1. Description of Compiler optimizations:Because memory access is far less than CPU processing speed, in order to improve the overall performance of the machine, hardware to introduce hardware cache caches, speed up the access to memory.
So it's best to page through the data, if this is the use of stored procedures to pagination. The following is a stored procedure for data paging using the employee table in the pubs database, which you can refer to to create your own stored
--A stored procedure with input parameters--
create proc getcomment
(@commentid int) as
select * from Comment where commentid=@ Commentid
--A stored procedure with input and output parameters--
create proc getcommentcount
@newsid int,
@count int
About the SQL statement pagination, there are a lot of online, I posted a part of it, and summed up their known pagination to the following to facilitate future access
1. Create a test environment (it takes about 5 minutes to insert 1 million data).
CS Page calling code:
Copy Code code as follows:
public int totalpage = 0;
public int pagecurrent = 1;
public int PageSize = 25;
public int rowscount = 0;
string userid, username;
public datatable dt = new DataTable ();
public
SQL Server, use exec to handle a variable in the SQL string, hint: The scalar variable must be declared @ (resolved!) )
Copy Code code as follows:
declare @tssj nvarchar (100)--External variables
declare @Sql_Sql nvarchar (100)--Save SQL
Recently in doing a millions of data paging query, studied a variety of scenarios, on the machine with the actual project database to do the test, testing process is very pain, forget ing. Now the nonsense is not much to say, directly on the results,
--drop procedure P_page
--go
CREATE PROCEDURE P_page
(
@Tables varchar (1000)--table name such as TestTable
@PrimaryKey varchar,--table's primary key, must be unique
@Sort varchar = NULL,--sort fields such as f_name ASC or F_name desc (Note that
Copy CodeThe code is as follows:
SET ANSI_NULLS on
Go
SET QUOTED_IDENTIFIER ON
Go
CREATE PROCEDURE [dbo]. [Pagination]
@Page int = 1,--current page number
@PageSize int = 10--Number of record bars per page (page size)
@Table nvarchar (500)--table
server|xml| Generate XML *
' bcp ' is not an internal or external command, nor is it a running program?
See if there's a bcp.exe file in C:\Program Files\Microsoft SQL Server\80\Tools\Binn.Then look inside the path add C:\Program Files\Microsoft SQL
server| Stored Procedures
Crystal Reports and Sql-server together for the development of reports
1:crystal Reports feature Readme
Crystal Reports is used to process databases to help users analyze and interpret important information. With Crystal
Brief introductionA stored procedure is a encapsulated process consisting of some SQL statements and control statements that reside in a database, can be called by a client application, or can be called from another procedure or trigger. Its
reading: SQL Storage is an important part of the database operation process, for some beginners is also more abstract difficult to understand, this article I will use a few examples to parse the database of SQL stored procedures, so that the
I. Overview of stored Proceduresstored procedures in SQL Server are code snippets written using T_sql. It is designed to easily query information from system tables, or to complete administrative tasks and other system administration tasks related
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.