With the development of the information age, more and more information systems are used, and more information is available. As the amount of information increases, data presentation, especially reports, is demanding more and more system presentation
During database usage, due to program problems, duplicate data may occur, which leads to incorrect database settings ......
During database usage, due to program problems, duplicate data may occur, which leads to incorrect database settings ......
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
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
Massive Data Query and paging optimization (Author: jyk from: csdn)
Http://community.csdn.net/Expert/TopicView3.asp? Id = 4180563Http://www.jyklzz.com/bbs/ demo pageThank you for your support !!!Yesterday I sent an invitation to help you test the
One of the power of T-SQL is the large volume of operation data. However, in some scenarios, the number of rows affected by T-SQL needs to be limited. For example, in the past, Yilong encountered a scenario where too many rows were changed at a time
-- Process duplicate table records (query and delete)
/*************************************** **************************************** **************************************** *******************************
1. Repeat records with the same num and
1. During the interview, I encountered a problem. I wrote a table with two fields, ID and name, to query all the data with duplicate names. The column is:
Select * from Xi A where (A. username) in (select username from Xi Group by username having
SET Ansi_nulls OFFGOSET QUOTED_IDENTIFIER OFFGOALTER PROCEDURE [dbo]. [Up_pagination]/***************************************************************** * Tens of millions of paging stored procedures * *************************************************
1. upgrade hardware
2. Create an index based on the query conditions, optimize the index, optimize the access mode, and limit the data volume of the result set.3. Expand the server memory4. Increase the number of server CPUs5. Do not set Automatic
How can I speed up queries?1. upgrade hardware2. Create an index based on the query conditions, optimize the index, optimize the access mode, and limit the data volume of the result set.3. Expand the server memory4. Increase the number of server
The SQL statement I used:
Delete from fp_sgfpxxWhere fphm in (select fphm from fp_sgfpxx group by fphm having count (fphm)> 1)And rowid not in (select min (rowid) from fp_sgfpxx group by fphm having count (fphm)> 1)
Delete duplicate invoice
Data obtained by one user is not obtained by other users:
Problem:
When using ADO to access the database, take a certain record (such as 20 rows) from a table and use it in the program, delete records after use (no need to update or delete records ).
Alter PROCEDURE [dbo]. [usp_DataPages]@ TableNames VARCHAR (200), -- table name, which can be multiple tables but cannot be aliases@ PrimaryKey VARCHAR (100), -- primary key, which can be null, but this value cannot be blank when @ Order is null@
Loop result set using Transact-SQL statements
You can use a Transact-SQL statement to traverse a result set in three ways.
One way is to useTempTable. In this way, you create the "snapshot" of the initial SELECT statement and use it as the basic
Attribute
Allowsorting:Allow paging?Pagesize:Page sizeCurrentpageindex:Current page,CurrentpageindexIt should be greater than or equal to 0 and less than or equalPagecountPagecount:Page numberVirtualitemcount:The DataGrid needs to calculate the
First, get the total number of data rows
CopyCode The Code is as follows: Set ansi_nulls on
Set quoted_identifier on
Go
Alter procedure [sq8reyoung]. [fenye_num]
(
@ Tablenames nvarchar (200 ),
@ Filter nvarchar (200 ))
As
If @ filter =''
Set @
081219 exercise set rowcount, set nocount No
-- Set the number of returned rows
Set rowcount 2
Select * From ttest
-- Set whether to return the affected number of rows
Set nocount No
Select * From ttest
Set nocount off
081218 exercise
Use
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.